From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c87bf30faa2b6b X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: [Q] To initialise or not. Date: 1996/04/27 Message-ID: #1/1 X-Deja-AN: 151741547 references: <484274071wnr@diphi.demon.co.uk> <3180CF00.17D5@lmtas.lmco.com> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-04-27T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >The whole idea is to guarantee predictability by initializing everything >to a known and consistent value, WITHOUT necessarily providing a valid >value on which the proram could (incorrectly) depend. Right. In fact, the compiler is *supposed* to initialize to an *invalid* value, whenever possible, in order to cause an exception. The reason this is not *required* is that some types don't have any invalid values. For example, type Integer likely uses up all the available bits for representing valid values, and we didn't want to require the compiler to store an extra bit in those cases. Requiring that would complicate the compiler, cause inefficiency, and cause trouble when interfacing to other languages. Another example: in a packed array of Booleans, you get one bit per component, which doesn't leave any extra bits for invalid values. A stand-alone Boolean variable, on the other hand, will probably get 8 bits, or 32 bits, so pragma Normalize_Scalars will cause "X: Boolean;" to be initialized to some bit pattern that represents neither True nor False. - Bob