comp.lang.ada
 help / color / mirror / Atom feed
From: Ken Garlington <garlingtonke@lmtas.lmco.com>
Subject: Re: To Initialise or not
Date: 1996/05/06
Date: 1996-05-06T00:00:00+00:00	[thread overview]
Message-ID: <318E42B0.3738@lmtas.lmco.com> (raw)
In-Reply-To: Pine.A32.3.91.960501022514.77921E-100000@trumpet.aix.calpoly.edu


Patrick Richard Wibbeler wrote:
> 
> What if either of the following occur...
> 1] For some reason the language is changed so that pointers are no longer
> initialized to null

Then I will personally find the instigators of this change, and SHOOT THEM.

At least using Ada 95 as a model for how Ada will evolve, I would say that
this is a risk that can reasonably be discounted. Furthermore, it is a risk
that can be applied equally well to every other language feature. For example,
what if the ability to use "others" in aggregates is removed?

I wouldn't use the evolution of C as a guide to the evolution of Ada.

> 2]  Someone attempts to re-write the code in another language that
> doesn't initialize pointers to null.  He/she may not know whether or not
> to initialize the pointer to null without looking closely at the code..

Not true. If someone is doing a mechanical translation of Ada to language X
(or X++?), then they should know that all pointers must have an initial value,
and that, unless explictly stated, the initial value is null. They should also
know that all attempts to dereference that object should be preceded by a check
to see if the object is null (otherwise, they aren't preserving the Ada semantics).

You could argue that the mechanical translation can be optimized, and that's true,
but you can do that optimization without the explicit initialization. In fact,
explicit initialization may make it harder to do the analysis, depending upon what
kind of flow analysis tools are being used.

You could also argue that the maintainer has a poor knowledge of Ada (or
X), and that explicit initializations make it less necessary to know the rules
of Ada, but that's going to get you into trouble that no amount of explicit
initialization will help!

Of course, it gets interesting if the target language has no concept of null
(or for that matter, of access types!). However, explicitly setting pointers
to null won't help that, either.

> Readability is not just for now.  It is for later.

Exactly. This is why anything added for readability should be _obvious_ to the
future maintainer, since the author isn't necessarily going to be around to
explain his coding style. I'm not seeing how this approach is quite so obvious
(particularly given the divergent explanations from its practitioners as to what
it's supposed to mean!).

> The main point is who knows who or why the code will be used in the
> future.  At such a small cost, the readability/maintainability in the
> future could be large.

Adding lots of little things at a small cost, without justifying them,
can often add up to something large in the future -- a large negative
maintenance cost.

-- 
LMTAS - "Our Brand Means Quality"




      reply	other threads:[~1996-05-06  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           ` 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             ` 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                 ` Chris Warack <sys mgr>
1996-05-02  0:00                   ` Robert A Duff
1996-05-06  0:00                   ` Ken Garlington
1996-05-02  0:00                 ` Robert A Duff
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               ` Theodore E. Dennison
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-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 [this message]
replies disabled

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