[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?)
From: |
Pascal J . Bourguignon |
Subject: |
Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?) |
Date: |
Mon, 2 Feb 2004 21:48:10 +0100 |
David Ayers writes:
> I think we are side tracking here a bit. The issue isn't whether we
> should use "!= NULL" comparison with pointers or similar comparisons
> with non-BOOL types. I think in general non-BOOL (esp. pointers) should
> use comparisons to attain a BOOL/truth expression to be used in for
> if/while/for evaluation. The issue is whether non-YES/NO values for a
> BOOL are valid.
I'd say that they're not valid.
- 100% correct and "conforming" code should not generate BOOL
values other than in {YES,NO}.
- 100% correct and "conforming" code should not compare a BOOL
value, it should test it as: if(bool_value) or
if([obj isSuchAndSuch]), etc.
- legacy code could compare a BOOL value with YES or NO to detect
"non-conforming" code.
- the next version should use #define BOOL _Bool
--
__Pascal_Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/
Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Helge Hess, 2004/02/01
Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Helge Hess, 2004/02/01