Re: Absense of bool



On Sun, 04 Nov 2007 09:53:31 +0000, Philip Potter
<pgp@xxxxxxxxxxxxxxx> wrote:
<snip>
Do you have an example of a language with a boolean type which will
store the boolean in a location smaller than a byte?

Pascal can use only 1 bit for a BOOLEAN and only the needed bits for a
(small) subrange or enum within an array or record, especially if you
declare it PACKED. At least in classic Pascal there is no way to take
the address of these so it doesn't matter that they aren't on a byte
(or word) boundary.

PL/I can do both of those for BIT(1), but AFAIK there's no syntax to
specify packing, so IMLE it is usually the default. (You can
explicitly declare padding, but it's hard to get it portably correct.)
PL/I also has BIT strings (fixed or variable-length=counted) which are
inherently packed, and whose elements cannot be pointed to (but can be
selected by SUBSTR).

Ada rather like Pascal has BOOLEAN and subrange/enum types, a general
option (pragma) for packing, and also more verbose options for exact
representation which allow you to really force desired packing.

- formerly david.thompson1 || achar(64) || worldnet.att.net
.



Relevant Pages

  • Re: PL/I and OOP
    ... it is more appropriate to use a case (PL/I select) statement. ... if the condition does not resolve to a boolean or ... a scalar, in most languages, a case statement is not allowed. ...
    (comp.lang.pl1)
  • Re: PL/I and OOP
    ... it is more appropriate to use a case (PL/I select) statement. ... if the condition does not resolve to a boolean or ... a scalar, in most languages, a case statement is not allowed. ...
    (comp.lang.pl1)