Page MenuHomeFreeBSD

cr_bsd_visible(): Style fix: Explicitly test for non-zero return codes
ClosedPublic

Authored by olce on Jan 5 2024, 5:02 PM.
Tags
None
Referenced Files
F97259392: D43335.diff
Sat, Sep 28, 9:06 AM
F97168643: D43335.diff
Sat, Sep 28, 12:43 AM
Unknown Object (File)
Tue, Sep 24, 2:50 PM
Unknown Object (File)
Tue, Sep 24, 2:49 PM
Unknown Object (File)
Tue, Sep 24, 2:49 PM
Unknown Object (File)
Tue, Sep 24, 2:46 PM
Unknown Object (File)
Tue, Sep 24, 4:48 AM
Unknown Object (File)
Mon, Sep 23, 11:52 PM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.Jan 5 2024, 5:02 PM
This revision is now accepted and ready to land.Jan 6 2024, 1:23 AM

jhb@ prefers such code to be written as

error = XXX();
if (error != 0)
   return (error);

jhb@ prefers such code to be written as

IMO that is indeed clearer.

jhb@ prefers such code to be written as

IMO that is indeed clearer.

For me it's a minor point, but I prefer to write things like:

if ((error = XXX) != 0)

when that fits on a single line, because I find C too verbose on this occasion: It cannot express very concisely to return from the current function with a given value if it is non-zero, without using macros. I wish we could settle on a "global", well-known macro to do exactly that.

Now, if you all prefer a separate line, of course I'll adopt that convention.

I will adapt the code above to this end at commit time.

This revision was automatically updated to reflect the committed changes.