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
Unknown Object (File)
Wed, May 13, 5:05 PM
Unknown Object (File)
Wed, May 13, 5:05 PM
Unknown Object (File)
Wed, May 13, 4:54 PM
Unknown Object (File)
Mon, Apr 27, 9:45 PM
Unknown Object (File)
Mon, Apr 27, 8:35 AM
Unknown Object (File)
Sun, Apr 26, 7:39 AM
Unknown Object (File)
Apr 20 2026, 8:31 PM
Unknown Object (File)
Apr 19 2026, 2:47 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.