[Gc] boehm-gc patch

Matthias Andree matthias.andree at gmx.de
Mon Dec 14 03:50:11 PST 2009


Am 14.12.2009 12:45, schrieb Jack Andrews:
> hi,
> 
>>> --- cord/cordxtra.c   10 Oct 2005 22:33:34 -0000      1.1.1.1
>>> +++ cord/cordxtra.c   14 Dec 2009 00:31:33 -0000
>>> @@ -574,7 +574,8 @@ CORD CORD_from_file_lazy_inner(FILE * f,
>>>       /* world is multithreaded.                      */
>>>       char buf[1];
>>>
>>> -     (void) fread(buf, 1, 1, f);
>>> +     /* This `if' construct avoids a warning from GCC. */
>>> +     if (fread(buf, 1, 1, f)) { }
>>>       rewind(f);
>>>      }
>>>      state -> lf_file = f;
>>
>> This is rather horrid.  Do we really care so much about compiler warnings
>> that we will put such contorted code into our programs?
> 
> if fread() fails, shouldn't there be error handling?
> 
> if not, define a macro
>   #define IGNORE(x) if(!(x)); /* ignore the result of x*/

You can just cast the return type to void, which - to me - seems a bit more
obvious. (No need to discuss this, just wanted to propose this alternative;
everybody can pick the version (s)he likes best.)


More information about the Gc mailing list