public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@cygnus.com>
To: bothner@cygnus.com (Per Bothner), egcs@cygnus.com
Subject: Re: bool
Date: Tue, 11 Nov 1997 18:44:00 -0000	[thread overview]
Message-ID: <u9d8k6q1aa.fsf@yorick.cygnus.com> (raw)
In-Reply-To: <199711112028.MAA08953.cygnus.egcs@cygnus.com>

>>>>> Per Bothner <bothner@cygnus.com> writes:

> Jason Merrill <jason@cygnus.com> writes:
>> Nonsense.  Most uses of bool are to store boolean values.  Most of these
>> values would have been type 'int' if 'bool' were not available.  If you
>> want packed data, you can use a bitvector or 'unsigned char'.

> Most uses of short are to store integer values.  Most of these
> values would have been type 'int' if 'short' were not available.
> What's your point?

My point is that C programmers use int to store flags.  They could use
short or unsigned char, but they use int.  Removing a 'typedef int bool'
and building with g++ should not make their code slower.

Naive users will use bool for a flag, not considering that it might
dramatically slow down an inner loop in their code.  If a knowledgeable
user wants to save space, they can use unsigned char, or a bitvector, or a
bitfield for that matter.

Basically, this is a space/time tradeoff, and there is no right answer.  My
opinion is that time is more important.  And in any case bool has been 4
bytes on RISC targets for the past couple of years, and I don't think it's
worth changing it now.

Jason

  parent reply	other threads:[~1997-11-11 18:44 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       ` bool Alexandre Oliva
     [not found]     ` <199711112028.MAA08953.cygnus.egcs@cygnus.com>
1997-11-11 18:44       ` Jason Merrill [this message]
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=u9d8k6q1aa.fsf@yorick.cygnus.com \
    --to=jason@cygnus.com \
    --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).