boolean

Karl Heuer karl at haddock.ima.isc.com
Tue Jun 5 06:03:26 AEST 1990


In article <20.266429f6 at spanky.mgi.com> Cepek at MGI.COM writes:
>Among our "company-common" .H files, the compiler/target-machine dependent
>one includes the following pseudo-types:
>#define bool    int8	/* smallest entity for TRUE or FALSE	*/
>#define boolean int	/* fast/simple entity for TRUE or FALSE	*/
>
>This allows the programmer to choose between space and speed.

Defining both `bool' and `boolean', with different meanings, is probably a
mistake.  The very existence of a typedef named `int8' is questionable.  (Yes,
I know the reason.)  And it's probably not worthwhile to have the `small'
type, since if you have enough of them that the factor of (probably) 4 is
significant, you might as well also go for the factor of (probably) 8 that you
get by using packed bit vectors.  (The time cost isn't as bad as one often
hears, since you don't normally have to go around packing and unpacking the
things--the common operations on booleans are test, set, and clear, none of
which is hard.  The only real pain is that you can't use normal C syntax; you
have to go through macros.)

Karl W. Z. Heuer (karl at ima.ima.isc.com or harvard!ima!karl), The Walking Lint
Followups to comp.lang.c.



More information about the Comp.std.c mailing list