From: "Samuel T. Harris" <u61783@gsde.hou.us.ray.com>
Subject: Re: Stream_Element_Array and an empty array
Date: Thu, 23 Aug 2001 09:02:17 -0500
Date: 2001-08-23T09:02:17-05:00 [thread overview]
Message-ID: <3B850CE9.DCC6533D@gsde.hou.us.ray.com> (raw)
In-Reply-To: 3B84C0DE.79F20395@amsjv.com
Philip Anderson wrote:
>
> "Samuel T. Harris" wrote:
> >
> <snip>
> > Given that in the above text A is a variable,
> > no assignment is necesary. If you must have
> > an assignment, or an initial expression
> > because it is constant, then you can
> > do the following ...
> >
> > nil : constant stream_element_array (1..0) := (others => 0);
> > ...
> > a := nil;
>
> That must the clearest Ada way of obtaining a zero-length array of a
> particular type; declare an example and give it a suitable name (Nil,
> Empty_Array, Zero_Length_Array, whatever), since the result of this
> particular Ada idiom is easier to understand given this clue. It then
> becomes obvious what you are doing when you pass it as a parameter.
>
Thanks for that.
For years (decades) I have made is a habit to always
define a nil constant for any interesting type.
Even my record types, whose every field declaration
has a default initial expression, also gets a nil_type
constant.
Along those lines, I also define width, image, and value
functions so I get easy instrumentation or I/O facilities
nearly for free.
--
Samuel T. Harris, Senior Software Engineer II
Raytheon, Aerospace Engineering Services
"If you can make it, We can fake it!"
prev parent reply other threads:[~2001-08-23 14:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-22 13:34 Stream_Element_Array and an empty array
2001-08-22 13:42 ` Samuel Tardieu
2001-08-22 13:56 ` Reivilo Snuved
2001-08-22 14:19 `
2001-08-22 14:25 `
2001-08-22 14:28 ` Florian Weimer
2001-08-22 14:37 `
2001-08-22 14:28 ` David C. Hoos
2001-08-22 15:13 ` Claude SIMON
2001-08-22 14:54 ` Ted Dennison
2001-08-22 14:22 ` Samuel T. Harris
2001-08-23 8:37 ` Philip Anderson
2001-08-23 14:02 ` Samuel T. Harris [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