In a message written on Thu, Mar 07, 2002 at 03:27:49PM -0500, Garance A Drosihn wrote: > As to the wording, PHK suggested that the wording for this > rule in style(9) be changed: > - - - > get rid of the word boolean, ie: change > Do not use ! for tests unless it is a boolean, e.g. use > to > Do not use ! for tests unless it is an integer type, e.g. use
Although C doesn't have the type "boolean", I believe this is a conceptual distinction. That is, we don't want to allow this: if (!uid) { /* do thing only root can do */ } Because UID is not a boolean type. It takes a range of values, and should be: if (uid == 0) { /* do thing only root can do */ } The only proper use of "!" is on a boolean type, defined as a type that has two values, 0, and everything else. Personally, I would clarify boolean in the document as follows: C does not provide a proper boolean type. As a result, FreeBSD uses integers for a boolean type. The boolean values are 0 for false, and all other values for true. All code using a boolean type must not depend on "true" having any specific value. -- Leo Bicknell - [EMAIL PROTECTED] - CCIE 3440 PGP keys at http://www.ufp.org/~bicknell/ Read TMBG List - [EMAIL PROTECTED], www.tmbg.org To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message