Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Richard Gorton <gorton@amt.tay1.dec.com>
Subject: Re: Boolean &amp; alpha &amp;X11R6 et al
Date: Wed, 25 Feb 1998 11:44:23 -0500	[thread overview]
Message-ID: <9802251644.AA06853@liszt.amt.tay1.dec.com> (raw)

>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

             reply	other threads:[~1998-02-25 16:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-25 16:44 Richard Gorton [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-02-25 19:51 Boolean &amp; alpha &amp;X11R6 et al Uncle George
     [not found] <34F44DD6.2E6E6B4@voicenet.com>
1998-02-25 18:20 ` Michal Jaegermann
1998-02-25 16:59 Uncle George
1998-02-25 16:52 Richard Gorton
1998-02-25 16:32 Uncle George
1998-02-25 16:26 Uncle George
1998-02-25 14:58 Stefan Schroepfer
1998-02-25 13:59 Uncle George
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox