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: David Ayers
Subject: Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?)
Date: Tue, 03 Feb 2004 14:44:06 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113

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 :-)

Cheers,
David




reply via email to

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