[notmuch] [PATCH] fix compiler warnings

Jeffrey Ollie jeff at ocjtech.us
Sun Nov 22 20:43:42 PST 2009


On Sun, Nov 22, 2009 at 9:22 PM, Carl Worth <cworth at cworth.org> wrote:
> On Sun, 22 Nov 2009 17:11:03 +0200, Dirk-Jan C. Binnema <djcb.bulk at gmail.com> wrote:
>>
>> -    write(2, msg, sizeof(msg)-1);
>> +    if (write(2, msg, sizeof(msg)-1) < 0) {
>> +         /* ignore...*/
>> +    }
>
> I don't like the gratuitous conditional here. It clutters the code and
> make is less clear. If we're just trying to squelch a warning about an
> unused return value from a function, then I think I'd rather see:
>
>        ssize_t ignored;
>
>        ignored = write (2, msg, sizeof (msg) - 1);

Isn't the usual method for ignoring return values casting to void?

(void) write (2, msg, sizeof (msg) - 1);

-- 
Jeff Ollie


More information about the notmuch mailing list