From 1250259243162651489
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,bf65828a2bbbc32e
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1993-12-13 15:41:20 PST
Path: gmd.de!urmel.informatik.rwth-aachen.de!hathi!dak
From: dak@hathi.informatik.rwth-aachen.de (David Kastrup)
Newsgroups: comp.std.c++
Subject: Re: bool run-time performance impact
Date: 13 Dec 1993 18:04:13 GMT
Organization: Rechnerbetrieb Informatik - RWTH Aachen
Lines: 21
Distribution: world
Message-ID: <2eiaqt$s87@urmel.informatik.rwth-aachen.de>
References: <trickr.11.000B9FAA@uh2372p03.daytonoh.ncr.com> <9334701.20716@mulga.cs.mu.OZ.AU> <2eh58b$fg6@nic.lth.se>
NNTP-Posting-Host: hathi.informatik.rwth-aachen.de
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Keywords: bool

dag@control.lth.se (Dag Bruck) writes:

>In <comp.std.c++> fjh@munta.cs.mu.OZ.AU (Fergus Henderson) writes:
>>It would be quite reasonable for compilers to use a non-canonical
>>representation where anything non-zero is true.  In this case,
>>conversion from int to bool would be a no-op.

>Not quite; the proposal explicitly says that a bool, when promoted to
>int, yields the values 0 or 1.

Well, what of it? Which of the two conversions has the work of
unifying was not specified, or was it? Is it told anywhere that
a pointer to a true bool has to convert to a pointer to a numeric
1? Certainly not. And the representation might differ between CPUs.
For 68xxx, I could imagine using the byte 0xff for true, 0x00 for false,
and usually bytewise logical operations for logic, if that proves
faster and without sideeffect.
-- 
 David Kastrup        dak@pool.informatik.rwth-aachen.de          
 Tel: +49-241-72419 Fax: +49-241-79502
 Goethestr. 20, D-52064 Aachen


