Date: Thu, 07 Mar 2002 00:37:22 -0500 From: admin@twwells.com To: freebsd-hackers@freebsd.org Subject: Re: RFC: style(9) isn't explicit about booleans for testing. Message-ID: <E16iqag-0002DA-00@bill.twwells.com> References: <200203061659.g26GxI979195@thistle.bogs.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Try this text instead: In C, there is no boolean type but there are boolean concepts, contexts that express or test yes/no, good/bad, error/success, pointer initialized/not initialized, object created/not created, and so on. Where a conceptually boolean operand is expected and you have a value that is not conceptually boolean, use an operator (e.g., ==, !=) that translates the operand to something that is conceptually boolean. This applies to "if" expressions, the operand of !, function parameters that want a conceptually boolean value, and so on. This is actually a special case of a more general rule, which might be stated: saving a few keystrokes but violating the expectations of strangers reading your code is not a good way to write maintainable code. Ensure that the code and your intention are congruent *in the mind of your readers*. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E16iqag-0002DA-00>