Sujet : Re: basic BASIC question
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.vmsDate : 02. Feb 2025, 01:35:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vnmel4$bktn$1@dont-email.me>
References : 1
User-Agent : Pan/0.161 (Chasiv Yar; )
On Fri, 31 Jan 2025 10:18:00 -0500, Arne Vajhøj wrote:
Is it common to use:
declare integer constant TRUE = -1
declare integer constant FALSE = 0
?
I can remember on the Motorola 68000, false was 0 (all bits clear) and
true was -1 (all bits set). Being a Pascal fan at the time, I thought this
was really a bad idea. In Pascal you have the equivalant of
type
boolean = (false, true);
so false clearly maps to 0 and true to 1.
Why is it important to insist on this? So that you can use boolean, like
any other discrete type, as an array index type. E.g.
var
double_buffer : array [boolean] of buffer;
thisbuf : boolean;
Glad to see that C99 sort-of agrees with Pascal. Certainly it says the
only *defined* values of bool type are 0 for false and 1 for true.