comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: To Initialise or not
Date: 1996/05/11
Date: 1996-05-11T00:00:00+00:00	[thread overview]
Message-ID: <Dr7upv.59v@world.std.com> (raw)
In-Reply-To: 31937B57.5B0@lmtas.lmco.com


In article <31937B57.5B0@lmtas.lmco.com>,
Ken Garlington  <garlingtonke@lmtas.lmco.com> wrote:
>I think there's something subtle here. In my mind, saying "I don't want to
>_use_ the literal null, since I want to reserve that to mean 'uninitialized'"
>makes some sense.

That's probably a better idea.  With tagged types, this becomes
convenient -- you have an "access to T'Class", and you have a special
derivative of T that means "None" or whatever, and point to that.
Reserve null to mean "Bad".  Use access parameters whenever possible
(since access parameters do a run-time check that the thing isn't null.)

>Well, if you do the former, you still might have to visit each unitialized
>case to ensure that a valid out-of-range value exists (although in this
>example, it's a pretty sure bet.) You would also have to add 'Valid to get
>reliable checking, so I'm not sure I see the advantage of just adding the
>pragma.

You don't have to use 'Valid to get usefulness out of pragma
Normalize_Scalars.  *Most* uses of a scalar variable will involve some
sort of constraint check, and Normalize_Scalars will ensure that these
checks fail for uninit vars.  Sad that it's not *all* uses, but that's
for efficiency.

The 'Valid attribute is for checking data that comes in from the outside
world.  You isolate this code, and use 'Valid before dealing with the
data.  'Valid is *not* for detecting uninitialized vars -- those happen
by accident, and are potentially scattered throughout the code.  So any
mechanism that requires the programmer to do something explicit (like
ask whether 'Valid) misses the point.

>I'm not sure that the tool has to do a particularly thorough job, just to
>find out the information you're attempting to convey with the literal null.
>However, we can agree to disagree on this.

OK.  :-)

- Bob




  reply	other threads:[~1996-05-11  0:00 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-29  0:00 To Initialise or not Steve O'Neill
1996-04-29  0:00 ` Ken Garlington
1996-04-29  0:00   ` Robert Dewar
1996-04-30  0:00     ` Ken Garlington
1996-04-30  0:00   ` Robert A Duff
1996-04-30  0:00     ` Ken Garlington
1996-04-30  0:00       ` Robert A Duff
1996-05-01  0:00         ` Keith Thompson
1996-05-01  0:00           ` Theodore E. Dennison
1996-05-01  0:00             ` Robert A Duff
1996-05-02  0:00               ` Theodore E. Dennison
1996-05-02  0:00                 ` Robert A Duff
1996-05-02  0:00                 ` Chris Warack <sys mgr>
1996-05-02  0:00                   ` Robert A Duff
1996-05-06  0:00                   ` Ken Garlington
1996-05-02  0:00               ` Michael F Brenner
1996-05-02  0:00                 ` Robert A Duff
1996-05-04  0:00                   ` Kevin D. Heatwole
1996-05-06  0:00               ` Ken Garlington
1996-05-07  0:00                 ` Robert A Duff
1996-05-08  0:00                   ` Ken Garlington
1996-05-08  0:00                     ` Robert A Duff
1996-05-09  0:00                       ` Ken Garlington
1996-05-09  0:00                         ` Robert A Duff
1996-05-01  0:00             ` Dale Stanbrough
1996-05-02  0:00             ` Robert Dewar
1996-05-02  0:00               ` Robert A Duff
1996-05-02  0:00               ` Theodore E. Dennison
1996-05-01  0:00           ` Robert A Duff
1996-05-02  0:00             ` Keith Thompson
1996-05-03  0:00               ` Robert A Duff
1996-05-06  0:00           ` Ken Garlington
1996-05-06  0:00         ` Ken Garlington
1996-05-07  0:00           ` Robert A Duff
1996-05-08  0:00             ` Ken Garlington
1996-05-09  0:00               ` Robert A Duff
1996-05-10  0:00                 ` Robert A Duff
1996-05-10  0:00                   ` Ken Garlington
1996-05-10  0:00                     ` Robert A Duff
1996-05-10  0:00                       ` Ken Garlington
1996-05-11  0:00                         ` Robert A Duff [this message]
1996-05-11  0:00                         ` David Kristola
1996-05-11  0:00                           ` Robert A Duff
1996-05-13  0:00                 ` Ken Garlington
1996-05-13  0:00                   ` Ken Garlington
1996-05-13  0:00                     ` Robert A Duff
1996-05-13  0:00                       ` Ken Garlington
1996-05-13  0:00                   ` Robert A Duff
1996-05-13  0:00                     ` Ken Garlington
1996-04-30  0:00     ` Robert A Duff
1996-05-01  0:00     ` Patrick Richard Wibbeler
1996-05-06  0:00       ` Ken Garlington
replies disabled

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