Page MenuHomeFreeBSD

style.9: be explicit about booleans in comparisons
AcceptedPublic

Authored by emaste on May 27 2021, 1:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 2 2024, 4:39 PM
Unknown Object (File)
Feb 19 2024, 10:10 PM
Unknown Object (File)
Feb 13 2024, 1:39 AM
Unknown Object (File)
Dec 20 2023, 1:16 AM
Subscribers
None

Details

Reviewers
imp
Summary

We prefer if (count > 0) to if (count) (non-boolean variables) but this is not mentioned in style.9. Make it explicit.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste created this revision.

Maybe should downgrade the statement to something like "if (count > 0) is preferred over if (count)"

share/man/man9/style.9
772

s/Use/Prefer

Incorporate imp's feedback and reword sentence slightly

Reword sentence once more to tie in better to the example

I'm good either way: with or without my suggestion.

This revision is now accepted and ready to land.May 27 2021, 2:06 PM

hit approve on earlier version, but I like the current one even better.