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: Alexander Malmberg
Subject: Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?)
Date: Wed, 04 Feb 2004 03:11:23 +0100

Richard Frith-Macdonald wrote:
> 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?

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.

- Alexander Malmberg




reply via email to

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