comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: float with 24-bit resolution
Date: Fri, 5 Sep 2003 14:37:12 -0500
Date: 2003-09-05T14:37:12-05:00	[thread overview]
Message-ID: <vlhpbhsvhh5564@corp.supernews.com> (raw)
In-Reply-To: _x36b.22730$su.613585@news20.bellglobal.com

"Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca> wrote in message
news:_x36b.22730$su.613585@news20.bellglobal.com...
> Randy Brukardt wrote:
> > You could "fix" that with a comment, but an explicit initializer works
> > just as well.
>
> But this also increases the maintenance cost if you change
> the nature or number of members of that object. It also
> creates a maintenance nightmare if the initialization
> defaults are changed (in the spec) but the explicit
> initialization undoes what is "correct" for it initially
> (ie. the worst case is when it compiles, but fails to
> work correctly because the incorrect initialization
> value remains, even though the spec has been corrected).

If your project has "visible" (i.e. non-private) record types where the
components can change, it has maintenance problems to begin with.
Initializers are the least of your problems. Inside the package,
initialization should always be done with aggregates (exactly so that missed
changes cause compile-time errors).

The problem here is the inconsistence of the language. Some types can be
implicitly initialized, and others cannot. That makes problems for private
types (because if you assume that they are implicitly initialized, you are
breaking privateness and/or significantly restricting the implementation (to
records and access types only). On the other hand, limited types can only be
initialized implicitly (that probably will change in Ada 200Y). Thus, it is
impossible for any rule to be completely consistent.

I do use implicit initializers in some cases (especially for limited types,
where nothing else is possible). But I prefer to make it explicit when
possible (generally reserving implicit initialization to marking an object
as "not valid").

                       Randy.








  reply	other threads:[~2003-09-05 19:37 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-15 11:59 float with 24-bit resolution mailbox
2003-08-15 12:24 ` Jeffrey Creem
2003-08-15 12:52   ` Adrian Hoe
2003-08-15 12:54     ` Adrian Hoe
2003-08-15 15:01       ` Jeffrey Creem
2003-08-16 15:29         ` Matthew Heaney
2003-08-15 13:39     ` Mark Johnson
2003-08-15 16:56       ` Robert I. Eachus
2003-08-15 18:08         ` Mark Johnson
2003-08-16  3:30           ` Robert I. Eachus
2003-08-18 13:39             ` Mark Johnson
2003-08-20 21:12               ` Robert I. Eachus
2003-08-21 13:38                 ` Mark Johnson
2003-08-16 15:32         ` Matthew Heaney
2003-08-16 15:26     ` Matthew Heaney
2003-08-15 19:56   ` Simon Wright
2003-08-16  4:21     ` Adrian Hoe
2003-08-16 12:59       ` Jeffrey Creem
2003-08-16 15:35     ` Matthew Heaney
2003-08-17 11:40       ` Simon Wright
2003-08-17 13:46         ` Matthew Heaney
2003-08-18  5:05       ` Adrian Hoe
2003-08-18 13:14         ` Matthew Heaney
2003-08-19  3:09           ` Adrian Hoe
2003-08-19 13:00             ` Matthew Heaney
2003-08-30  5:02           ` Randy Brukardt
2003-09-02 16:05             ` Adrian Hoe
2003-09-03  3:31               ` Matthew Heaney
2003-09-03 20:46                 ` Simon Wright
2003-09-04  1:43                   ` Randy Brukardt
2003-09-04  9:53                     ` Jean-Pierre Rosen
2003-09-05  3:46                       ` Randy Brukardt
2003-09-05 17:16                     ` Warren W. Gay VE3WWG
2003-09-05 19:37                       ` Randy Brukardt [this message]
2003-09-06 20:48                         ` Warren W. Gay VE3WWG
2003-09-08  7:53                         ` Dmitry A. Kazakov
2003-09-04  1:45                 ` Randy Brukardt
2003-08-16  3:42   ` Robert I. Eachus
2003-08-16 15:38     ` Matthew Heaney
2003-08-16 16:36       ` Robert I. Eachus
2003-08-16 15:22 ` Matthew Heaney
2003-08-17 11:46   ` Simon Wright
2003-08-18 10:04     ` Martin Dowie
2003-08-20 19:53       ` Robert I. Eachus
2003-08-20 23:36         ` Ludovic Brenta
2003-08-21 13:54           ` Mark Johnson
2003-08-21 14:35             ` Ludovic Brenta
2003-08-22 14:07               ` Mark Johnson
2003-08-22 15:12                 ` Jean-Pierre Rosen
replies disabled

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