[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: |
Helge Hess |
Subject: |
Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?) |
Date: |
Tue, 3 Feb 2004 01:21:28 +0100 |
On 02.02.2004, at 20:47, Nicola Pero wrote:
I would again like to point out that if the intention was to limit
BOOL
to YES and NO, it would have been defined as
typedef enum { YES, NO } BOOL;
Wouldn't this have been a waste a space just to just store a YES/NO ?
Well, isn't that you who is suggesting that a "true boolean" is worth
major restrictions? ;-)
Your point is pretty mood because:
a) BOOL is *NOT* specified to be char and indeed is not mapped to char
on
some platforms
b) even char is as wasteful requiring 8 times the memory necessary
(which is why everyone is using bitfields anyway) - apparently it is
worth that
Is int more wasteful than that:
@interface MyFunkyObject
{
BOOL a;
BOOL b;
}
I guess not, because a and b are probably aligned to 32 bits
boundaries. Is
- (void)doIt:(BOOL)_a
more wasteful than int? I also guess not, because the register _a is
being passed in is available in any case and probably not going to be
shared by multiple char variables.
In short: the practical gain of using char for BOOL is minimal,
especially in comparison to the already wasteful use of char instead of
a bit.
Greets,
Helge
PS: this discussion is a lot of fun - and I indeed learned a lot I
didn't knew before ;-)
--
http://docs.opengroupware.org/Members/helge/
OpenGroupware.org
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Richard Frith-Macdonald, 2004/02/01
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), David Ayers, 2004/02/02
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Richard Frith-Macdonald, 2004/02/02
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Richard Frith-Macdonald, 2004/02/02
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Helge Hess, 2004/02/02
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Nicola Pero, 2004/02/02
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Pascal J . Bourguignon, 2004/02/02
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?),
Helge Hess <=
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Pascal J . Bourguignon, 2004/02/03
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Pascal J . Bourguignon, 2004/02/03
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Richard Frith-Macdonald, 2004/02/02
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Helge Hess, 2004/02/02
- Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Pascal J . Bourguignon, 2004/02/02