[Info-vax] basic BASIC question
Lawrence D'Oliveiro
ldo at nz.invalid
Sat Feb 1 19:35:48 EST 2025
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.
More information about the Info-vax
mailing list