Re: [PATCH] af_unix: Don't set err in unix_stream_read_generic unless there was an error

From: Ben Hutchings
Date: Fri Feb 12 2016 - 19:19:42 EST


On Fri, 2016-02-05 at 22:30 +0000, Rainer Weikusat wrote:
> The present unix_stream_read_generic contains various code sequences of
> the form
>
> err = -EDISASTER;
> if ()
> goto out;
[...]

I wish people would stop writing code like this. ÂAt one time it may
have been a useful micro-optimisation, avoiding an extra branch in the
successful case, but gcc now appears to do that itself. ÂSo it makes
the code less clear and runs the risk of introducing this sort of bug,
for no obvious benefit.

Ben.

--
Ben Hutchings
Sturgeon's Law: Ninety percent of everything is crap.

Attachment: signature.asc
Description: This is a digitally signed message part