| Summary: | [PATCH] style(9) isn't explicit about booleans for testing. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Documentation | Reporter: | mwm | ||||
| Component: | Books & Articles | Assignee: | Tom Rhodes <trhodes> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Latest | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
mwm
2001-06-30 22:30:01 UTC
Mike Meyer <mwm@mired.org> writes: > > >Number: 28555 > >Category: docs > >Synopsis: [PATCH] style(9) isn't explicit about booleans for testing. > >Description: > > The style(9) page says not to use ! for testing values unless the > value is a boolean. It also says to test pointers against NULL. This > leaves open the question of how other values that aren't booleans > should be tested. > > >How-To-Repeat: > > Read the man page to try and decide if you should write "if (x)" or > if (x != 0). I think it is quite clear on the subject. If it's not a boolean, don't treat it like one; i.e., compare it against the value you're looking for. '0' may not always be that value. Regardless, this does not belong as a PR, let alone in the docs/ category. It belongs as a post on -hackers, asking what people think, not as a change request. Since *developers* are expected to follow style(9), it is the *developers* (i.e., -hackers@) that you should be proposing the change to. Dima Dorfman dima@unixfreak.org Dima Dorfman <dima@unixfreak.org> types: > Mike Meyer <mwm@mired.org> writes: > > > > >Number: 28555 > > >Category: docs > > >Synopsis: [PATCH] style(9) isn't explicit about booleans for testing. > > >Description: > > > > The style(9) page says not to use ! for testing values unless the > > value is a boolean. It also says to test pointers against NULL. This > > leaves open the question of how other values that aren't booleans > > should be tested. > > > > >How-To-Repeat: > > > > Read the man page to try and decide if you should write "if (x)" or > > if (x != 0). > I think it is quite clear on the subject. If it's not a boolean, > don't treat it like one; i.e., compare it against the value you're > looking for. '0' may not always be that value. I did overstated the case in the description. I agree that it's clear on the subject; I think it needs to be made explicit. > Regardless, this does not belong as a PR, let alone in the docs/ > category. It belongs as a post on -hackers, asking what people think, > not as a change request. Since *developers* are expected to follow > style(9), it is the *developers* (i.e., -hackers@) that you should be > proposing the change to. We both agree I'm not proposing a change in the style they have to follow; I'm just proposing making something explicit instead of implicit. As such, I'm not sure it warrants discussion. If the PR belongs in another category, please feel free to move it to either move it or suggest one for someone else to move it to. Thanx, <mike -- Mike Meyer <mwm@mired.org> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. Mike Meyer <mwm@mired.org> writes: > Dima Dorfman <dima@unixfreak.org> types: > > Regardless, this does not belong as a PR, let alone in the docs/ > > category. It belongs as a post on -hackers, asking what people think, > > not as a change request. Since *developers* are expected to follow > > style(9), it is the *developers* (i.e., -hackers@) that you should be > > proposing the change to. > > We both agree I'm not proposing a change in the style they have to > follow; I'm just proposing making something explicit instead of > implicit. As such, I'm not sure it warrants discussion. I'm not suggesting that you should get every developer's approval, but I am suggesting that wider review than the -doc list would be nice, esp. for a document that defines policy. Dima Dorfman dima@unixfreak.org Responsible Changed From-To: freebsd-doc->trhodes I'll take this. State Changed From-To: open->closed This should have been closed a good while ago. We do not need an example of every type of 0. Furthermore, the current version of style(9) is correct and the suggested patch seems to be getting the tests in both of the examples backwards starting from a non-backwards example of '0'. If wording is that large of an issue, please bring it up on the mailing lists. Thanks! |