Deutsch English Français Italiano |
<vnmel4$bktn$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro <ldo@nz.invalid> Newsgroups: comp.os.vms Subject: Re: basic BASIC question Date: Sun, 2 Feb 2025 00:35:48 -0000 (UTC) Organization: A noiseless patient Spider Lines: 28 Message-ID: <vnmel4$bktn$1@dont-email.me> References: <vnipj8$3i2i9$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 02 Feb 2025 01:35:49 +0100 (CET) Injection-Info: dont-email.me; posting-host="670c9d33294224a7eab87df43d0ee30f"; logging-data="381879"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18biQD5D2OevpF7pz8XavGQ" User-Agent: Pan/0.161 (Chasiv Yar; ) Cancel-Lock: sha1:44T/h3h1BAdebno1fF3N6eBTnnk= Bytes: 1753 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.