gnustep-dev
[Top][All Lists]
Advanced

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

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


From: Richard Frith-Macdonald
Subject: Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?)
Date: Tue, 3 Feb 2004 14:53:52 +0000


On 3 Feb 2004, at 13:44, David Ayers wrote:

Nicola Pero wrote:

Anyway to come to the point, while I see a good reason to say in our
coding standards that good code should try to work with non-{NO,YES}
values of BOOL for compatibility with C, I don't see any sound reason to contradict the NeXTstep/Apple Objective-C Language Reference and actually
encourage or formalize as good such a use.

I'd propose the following -

"A BOOL should take either the value NO or the value YES; different
values should not occur in well written Objective-C code.

But to be easily compatible with code not following these standards
and which might mix BOOLs and C truth values (where zero is false and
anything non-zero is true), it's better to avoid comparing BOOL values
directly to YES; it's safer to compare them to NO."


This is fine also :-)

Yes.

Does anyone really have problems with replacing cases of 'x == YES' with
isYES(x) where non YES/NO values of x are treated as YES but generate
a one-time warning?





reply via email to

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