gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFA]: BOOL coding standards (Was: Problem with+numberWithBool: ?)


From: Kazunobu Kuriyama
Subject: Re: [RFA]: BOOL coding standards (Was: Problem with+numberWithBool: ?)
Date: Sun, 01 Feb 2004 18:10:06 +0900
User-agent: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.4) Gecko/20030624 Netscape/7.1

Alexander Malmberg wrote:

+
+When using BOOL values, care should be taken to ensure to ensure that all
+non-zero values are treated as true.
+
+Methods that return BOOL values should return only YES or NO to avoid
+triggering problems in code that treats only YES as true.

In the first paragraph, we see 'to ensure' twice...

In the last paragraph, I think 'should' should be replaced with 'must'.
Otherwise, we would have to verify not only code itself but also its
all possible usage.  This makes bug tracking awfully tedious (rather,
substantially impossible).

Suppose we find a bug in a method that returns BOOL values and that
the method doesn't follow the proposed coding standard.  Because of
'should', this violation wouldn't be ruled out.  Then, we can
attributes the bug to both the callee (code itself) and the caller
(usage of the method).  If someone considers that the bug is due to
the callee, then she/he is likely to begin a similar thread again:
"The callee should not use a comparison against YES..."

- Kazunobu Kuriyama






reply via email to

[Prev in Thread] Current Thread [Next in Thread]