cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: preparing for another public release

From: Kevin D. Bond <kdb_at_korl.com>
Date: Sun, 2 Mar 2003 15:04:19 -0500

On Sunday, March 2, 2003, at 01:40 PM, Andi Jahja wrote:

> On Sun, 2 Mar 2003 18:21:47 +0100 (CET) Daniel Stenberg
> <daniel_at_haxx.se> wrote:
>
>>> Borland CPP :
>>>
>>> \telnet.c:
>>> Warning W8019 telnet.c 266: Code has no effect in function
>>> send_negotiation
>>> Warning W8019 telnet.c 830: Code has no effect in function suboption
>>> Warning W8019 telnet.c 838: Code has no effect in function suboption
>>> Warning W8019 telnet.c 860: Code has no effect in function suboption
>>
>> Do you know why you get this warning on the use of the swrite() macro?
>
> I am not sure. But Borland is pretty strange IMO. We could get rid of
> these annoying warnings by assigning send() return value to a dummy
> variable like:
>
> int dummy;
>
> dummy = swrite(.......);
>
> But of course this has no meaning other than killing those warnings.
>

I am fairly certain that this is because on WIN32 with the Borland
compiler swrite is a (size_t) casted function call. The cast tells the
compiler to create a temporary variable to store the result of the
conversion, which is never used. If the code is optimized, the
conversion and the unused temporary variable will be removed. In debug
code many (not all) compilers will leave the temporary and conversion
code. Explicitly casting the result of swrite to (void) should
suppress the warning when the return value is not tested. Seems like a
bug waiting to happen not to correctly test for the return code in
these places.

-kevin

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-03-02