At 2:16 AM -0500 3/7/02, Brian T.Schellenberger wrote: >Maybe your brain has gotten used to it, but to us ordinary >mortals, even us ordinary mortals who've been slogging C >code for time periods that can be measured in decades >(yikes!), it is very tempting to read > > if (!strcmp(a,b,l)) > >as "if the strings don't compare" which, in ordinary usage, >means don't compare *equal*. But of course the C program >is going to proceed to do exactly the opposite of that.
Okay, I will agree I have made that mistake a few times. Not often, but it really burns me up when I realize that's the source of some bug. So, that sounds like a good reason. >But *ALL* of this is beside the nominal point ANYWAY, which >is to discuss the proper wording for the man(9) style guide >which is supposed to document how things things are actually >done in the kernel, not personal preference. 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 - - - Dave O'Brien claimed the very same rule was *only* there to prevent "if (!strcmp(a,b))". May I suggest that we probably want two different rules? Change the current rule so it says 'integer type' instead of 'boolean' (which doesn't really exist in C anyway), and then add the rule about strcmp()? -- Garance Alistair Drosehn = [EMAIL PROTECTED] Senior Systems Programmer or [EMAIL PROTECTED] Rensselaer Polytechnic Institute or [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message