boolean
Kaleb Keithley
kaleb at mars.jpl.nasa.gov
Wed Jun 6 01:58:49 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.
All the compilers I've seen for 80x86 (excepting 80[34]86) always allocate
at least one word in the stack frame for variables, even if only one byte
is needed. I surmised that it was to keep the stack pointer aligned to an
even address, which allows for a small speed improvement on the
8086/80186/80286 (but no speed improvement on 8088/80188.) Static variables
were allocated less discriminitely, but were suitably aligned as required.
Not having worked with 680x0, so I can't comment reliably on that architecture,
and I haven't delved into the code generated by the compiler on our SPARCS,
but in both cases, I'd hazard a guess that a similar consideration might come
into play.
So, IMHO, I'd guess that letting the programmer choose between space and
speed would be halfty-fifty at best. Half a chance at getting it right,
50% chance of getting it wrong. My rule of thumb has always been: "Make it
work first, then make it fast."
kaleb at thyme.jpl.nasa.gov Jet Propeller Labs
Kaleb Keithley
More information about the Comp.lang.c
mailing list