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: Nicola Pero
Subject: Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?)
Date: Wed, 4 Feb 2004 17:14:45 +0000 (GMT)

> After some discussion in #GNUstep, and in the interest of ending this,
> I'll suggest something that I can live with (although it is on the outer
> fringes of acceptable silliness):
> 
> Methods that produce BOOL values must produce only the values 1 (YES) or
> 0 (NO).
> 
> Methods that accept BOOL values must handle all non-zero values as true,
> and may use the isYES macro to do so. isYES must, preferably by default,
> but at least optionally, expand to nothing, ie.:
> 
> #define isYES(x) (x)
> 
> What it expands to in other cases I don't care about, as long as the
> default is reasonably sane.

That looks fine - thanks for trying to settle this down - but I'd prefer
to omit mention of the isYES() macro altogether.  What about -

"Methods that produce BOOL values must produce only the values 1 (YES) or
0 (NO).

Handling of BOOL values must handle all non-zero values as true; for this
reason it is better not to compare BOOL values directly with YES, but to
treat all values which are not NO as true."

I suppose the isYES() macro would comply with this, so it would be Ok by
our coding standards.





reply via email to

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