public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@dcc.unicamp.br>
To: Per Bothner <bothner@cygnus.com>
Cc: egcs@cygnus.com
Subject: Re: bool
Date: Tue, 11 Nov 1997 18:24:00 -0000	[thread overview]
Message-ID: <or67pyc0rd.fsf@grupiara.dcc.unicamp.br> (raw)
In-Reply-To: <199711112028.MAA08953@cygnus.com>

Per Bothner writes:

> My point is about user expectations and standardization.
> Most users will be surprised if bool takes 4 bytes.
> The natural expectation is that bool is one byte.

The natural expectation is that bool takes one bit.  bool could have
been defined as:

typedef enum {false=0, true=1} mybool;

Enums are represented as integral types large enough to hold their
whole set of values.  AFAIK, gcc won't use a single byte to represent
mybool, so why should it for a bool?

Using int as the underlying type is much faster than anything else
and, if one really wants it to be packed, s/he can use bitfields.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil

  reply	other threads:[~1997-11-11 18:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-11  8:27 bool Andrew Borthwick
1997-11-11 10:52 ` bool Per Bothner
     [not found] ` <199711111843.KAA03525.cygnus.egcs@cygnus.com>
1997-11-11 12:13   ` bool Jason Merrill
1997-11-11 12:28     ` bool Per Bothner
1997-11-11 18:24       ` Alexandre Oliva [this message]
     [not found]     ` <199711112028.MAA08953.cygnus.egcs@cygnus.com>
1997-11-11 18:44       ` bool Jason Merrill
1997-11-12  5:59         ` bool John Carr
1997-11-12  6:25           ` bool Torbjorn Granlund
1997-11-11 15:29 Andrew Borthwick
1997-11-12  2:47 ` bool Branko Cibej

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=or67pyc0rd.fsf@grupiara.dcc.unicamp.br \
    --to=oliva@dcc.unicamp.br \
    --cc=bothner@cygnus.com \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).