comp.lang.ada
 help / color / mirror / Atom feed
From: Ken Garlington <garlingtonke@lmtas.lmco.com>
Subject: Re: To Initialise or not
Date: 1996/04/30
Date: 1996-04-30T00:00:00+00:00	[thread overview]
Message-ID: <3185E379.7C20@lmtas.lmco.com> (raw)
In-Reply-To: DqnGoz.10v@world.std.com


Robert A Duff wrote:
> 
> To me, "X: Some_Pointer;" means X is a pointer, which I plan to
> initialize at some later point before reading it, whereas, "X:
> Some_Pointer := null;" means X is is a pointer, where the first use
> might well be "if X = null then ...".

OK, so if an initialization to null lets me know that I may see the
object compared to null later:

1. What do I do with this information? Why is it useful for me to know
   that you may later be comparing the value to null?

2. What should I conclude if this convention is broken -- for example,
   if you compare it to null, but don't explicitly initialize it to null,
   or conversely initialize it to null but fail to compare it to null?
   Should I be concerned? Is it just a case where a null compare was
   removed during maintenance, and I shouldn't care? Or what?

3. How do you relay this convention to the reader, so that they understand
   what it means?

It just seems like effort without much payoff, at least from a maintainability
standpoint...

> ":= 0" might be mistaken for ":= O", for an integer, if there's
> an integer variable O lying around.  Or ":= mull" might have meant ":=
> nell", for a private type, if there are "mull"s and "nell"s lying
> around.  This doesn't seem like a big risk to me.

And I would equally object to someone initializing all integers to zero,
just to show it's an integer, or to say that they _might_ be comparing the
integer to zero later! In my mind, if it's necessary to initialize
the value, do so. If no initial value is needed (or the language gives
you the correct initial value automatically), why take the risk, even if
it's not a big one? Are you some sort of thrill-seeker? :)

What about other default initializations, like others => ... ? It might
not be less efficient (code-wise) to always spell out every component,
and then you wouldn't be relying on the "efficiency hack" of this clause,
and trusting the compiler to do the initialization of all unspecified
components. Is this also part of such a coding style?

-- 
LMTAS - "Our Brand Means Quality"




  reply	other threads:[~1996-04-30  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 [this message]
1996-04-30  0:00       ` Robert A Duff
1996-05-01  0:00         ` Keith Thompson
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-01  0:00           ` Theodore E. Dennison
1996-05-01  0:00             ` Dale Stanbrough
1996-05-01  0:00             ` Robert A Duff
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-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-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-02  0:00             ` Robert Dewar
1996-05-02  0:00               ` Robert A Duff
1996-05-02  0:00               ` Theodore E. Dennison
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
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