comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: Possible to recover default value of scalar type?
Date: Tue, 15 Dec 2020 10:14:59 -0800 (PST)	[thread overview]
Message-ID: <a75e5fc2-8393-4c2b-85b9-7c3b4cfef85dn@googlegroups.com> (raw)
In-Reply-To: <ly7dpjdn88.fsf@pushface.org>

Simon Wright schrieb am Dienstag, 15. Dezember 2020 um 17:54:01 UTC+1:
> I suppose the compiler could still detect & warn about inadvertent use 
> of the don't-care value.
Just a story about my work (long ago):
Our coding standard required for every type declaration a default value that indicated an uninitialised value:

type T is ...
Nd_T: constant T := ...;  -- Nd: not defined
X: T := Nd_T;  -- required

The idea was that this Nd value should be thus that it would be likely to produce an exception when used in an expression. Also any change of this value should have absolutely no effect on the code.
In any case, at some time it was decided that the Nd value for numeric types was 0. The effect:
It was no longer possible to see whether in a declaration like
X: T := Nd_T;
this values denoted a truly undefined value or a concrete and correct initial value.

  reply	other threads:[~2020-12-15 18:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-13  9:54 Possible to recover default value of scalar type? reinert
2020-12-14  0:08 ` Stephen Leake
2020-12-14  6:09   ` reinert
2020-12-14  9:01     ` AdaMagica
2020-12-14  9:38       ` Dmitry A. Kazakov
2020-12-14 15:56         ` AdaMagica
2020-12-14 16:31           ` Dmitry A. Kazakov
2020-12-14 18:24             ` Simon Wright
2020-12-14 18:53               ` Dmitry A. Kazakov
2020-12-15  6:47                 ` J-P. Rosen
2020-12-15  7:23                   ` Dmitry A. Kazakov
2020-12-15  9:07                     ` J-P. Rosen
2020-12-15 16:53                       ` Simon Wright
2020-12-15 18:14                         ` AdaMagica [this message]
2020-12-17  0:53                           ` Randy Brukardt
2020-12-17  0:48                   ` Randy Brukardt
2020-12-15  1:27           ` Randy Brukardt
2020-12-15  9:30             ` Niklas Holsti
2020-12-17  0:45               ` Randy Brukardt
2020-12-15  1:26         ` Randy Brukardt
2020-12-15  7:35           ` Dmitry A. Kazakov
2020-12-17  0:43             ` Randy Brukardt
2020-12-15  1:21       ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox