Re: [PATCH] run-command: prettify -D_FORTIFY_SOURCE workaround
Am 3/16/2011 6:37, schrieb Junio C Hamano:
Show 11 quoted lines
> It certainly is _not_ "ok" to see errors from write(2); we are _ignoring_
> the error because at that point in the codepath there isn't any better
> alternative. The unusual "if ()" whose condition is solely for its side
> effect, with an empty body, is a strong enough sign to any reader that
> there is something fishy going on, and it would be helpful to the reader
> to hint _why_ such an unusual construct is there. It would be much better
> for the longer term maintainability to say at least "gcc" in the comment,
> i.e.
>
> if (write(...))
> ; /* we know we are ignoring the error, mr gcc! */
And what about compilers that warn:
';' : empty controlled statement found; is this the intent?
That's from MSVC. Perhaps:
if (write(...))
(void)0; /* we know we are ignoring the error, mr gcc! */
-- Hannes