Xref: utzoo comp.std.c:3196 comp.lang.c:29356 Path: utzoo!utgpu!watserv1!watmath!att!rutgers!usc!snorkelwacker!bu.edu!mirror!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.std.c,comp.lang.c Subject: Re: boolean Message-ID: <16784@haddock.ima.isc.com> Date: 4 Jun 90 20:03:26 GMT References: <12986@smoke.BRL.MIL> <5907@buengc.BU.EDU> <4232@castle.ed.ac.uk> <13003@smoke.BRL.MIL> <20.266429f6@spanky.mgi.com> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Followup-To: comp.lang.c Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 21 In article <20.266429f6@spanky.mgi.com> Cepek@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@ima.ima.isc.com or harvard!ima!karl), The Walking Lint Followups to comp.lang.c.