comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: [Q] To initialise or not.
Date: 1996/04/28
Date: 1996-04-28T00:00:00+00:00	[thread overview]
Message-ID: <dewar.830721960@schonberg> (raw)
In-Reply-To: 75602294@dorunth.hb.north.de


Thorsten says

"   declare
     X :  INTEGER
       := 12;
       -- 'X' is initialized to 12 here because ...
       -- It will be changed to '13' under the following circumstances ...
       -- in the code piece following.
   begin
     if not ... then
       X := 13;"

recommending that all variables be initialized.

I am not sure I like this. Now you replae the possible error of not
initializing a variable with using a junk value (here using a 12
when a 12 is not intended). Furthermore, messing around with conditions
and putting not's in front of them seems to me to be undesirable.

I am not saying that this is never a good idea, but personally I prefer
not to initialize variables unless it makes obvious good sense to do so.

By the way, I see this as totally unrelated to the issue of choosing good
names for variables and properly docuenting declarations.

Interesting that some programmer would be scornful of this (using the
word secretary, presumably NOT not in a complimentary sense). Sounds
like that is a programmer who I would NOT want working on my projects.
All programmers should be secretaries :-)





  reply	other threads:[~1996-04-28  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-25  0:00 [Q] To initialise or not JP Thornley
1996-04-26  0:00 ` Theodore E. Dennison
1996-04-26  0:00   ` Robert A Duff
1996-04-27  0:00     ` Thorsten Behrens
1996-04-28  0:00       ` Robert Dewar [this message]
1996-04-30  0:00       ` mjp
1996-05-02  0:00       ` Bob Gilbert
1996-04-26  0:00 ` Ken Garlington
1996-04-26  0:00 ` Robert I. Eachus
1996-04-26  0:00 ` Ken Garlington
1996-04-26  0:00   ` Robert A Duff
1996-04-27  0:00   ` Robert Dewar
1996-04-27  0:00     ` Robert A Duff
1996-04-27  0:00 ` Robert Dewar
replies disabled

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