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)
Thu, Nov 14, 2:33 PM
Unknown Object (File)
Wed, Nov 13, 6:25 PM
Unknown Object (File)
Oct 4 2024, 8:57 AM
Unknown Object (File)
Oct 4 2024, 1:29 AM
Unknown Object (File)
Sep 28 2024, 1:18 PM
Unknown Object (File)
Sep 28 2024, 11:23 AM
Unknown Object (File)
Sep 28 2024, 9:06 AM
Unknown Object (File)
Sep 28 2024, 12:43 AM
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.