From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9802251644.AA06853@liszt.amt.tay1.dec.com> Date: Wed, 25 Feb 1998 11:44:23 -0500 From: Richard Gorton Subject: Re: Boolean & alpha &X11R6 et al >I mean change the concept of Boolean for all of X11R6 et al. from char >->int/long! > >Stefan Schroepfer wrote: > > Uncle George ( Garlic Pizza Specialist ) wrote: > > > > does anyone know what Boolean cant be defined as int, or long on an > > alpha? it seems that the current definition of char would not be in the > > best interests considering the alpha architecture. > > Why not simply take long? In C++, sizeof (bool) == 8. > Why change it? What is gained by changing it? In reality, a boolean is a '1' or a '0', but has been implemented as an 8-bit-byte for convenience on most platforms for most languages. Languages which have built-in bit strings or bit datatypes may choose to implement this as a single bit. I know that some implementations of PL/I do this (yeah, it still exists - I worked on a UNIX compiler for PL/I). Choosing a relatively small implementation for a boolean is beneficial for a variety of reasons: - Direct memory/disk savings. Storing a byte in memory vs. 4 bytes (or 8 if a long is used on Alpha) is a significant memory savings. Would you be annoyed if your executables in size by 10%? I would. The 10% number is a total guess, but consider that boolean variables sitting in the .data section (and elsewhere in the object file) now get much larger. Same situation with local (stack) and heap (malloc) variables. Consider the size increase of your OS kernel... - Indirect memory effects (cache) Bigger memory footprints frequently translate into slower executing programs, for instruction and data caches. - Executable size/speed On CISC machines, the size of the instructions to perform 32-bit (or larger) operations may take up more bytes of code than the size of the instructions to perform the same operations on single-byte data. This isn't particularly relevant on RISC machines. - Source code compatability with old code Any pre-existing code which has unions of booleans and or/assumptions about sizeof(char) == sizeof(boolean) currently works. Changing this could possibly require significant recoding. It's not necessarily good or bad, it just requires work. It can be done, but there are non-trivial drawbacks to doing so. If memory and disk were free, then it might make more sense. Rick Richard Gorton All standard disclaimers apply. AMT/Digital Semiconductor Projects: DECmigrate (mx), FreePort Express, Digital Equipment Corporation Linux/Alpha, JavaOS, StrongARM, Reply-to: gorton@tallis.enet.dec.com Network Computers (SHARK) http://www.digital.com/info/semiconductor/amt -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com