comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: Compiler default initialization of array types
Date: Thu, 17 Oct 2002 09:42:24 -0400
Date: 2002-10-17T09:42:24-04:00	[thread overview]
Message-ID: <uqtfi1i12aa730@corp.supernews.com> (raw)
In-Reply-To: aombha$ong$1@newstoo.ericsson.se


"Sebastian" <sebastian.madunic@avionics.saab.se> wrote in message
news:aombha$ong$1@newstoo.ericsson.se...
> I wonder if Ada always assignes Array types with default values?

Only if the component subtype is default initialized.  Otherwise no.

For example:

declare
   S : String (1 ..10);
begin

The array S is NOT initialized.

However, if we have this:

type String_Access_Array is
    array (Positive range <>) of Ada.Strings.Unbounded.String_Access;

declare
   S  : String_Access_Array (1 .. 10);
begin

Then here array S IS initialized.

> In case this is true; is there some way to suppress this feature?

As someone already pointed out, you might be able to use pragma Import (Ada,
<array object>) to suppress the initialization, but I haven't tried this
with an array object.  Another possibility is to turn off
default-initialization of the array component subtype.  Is there a pragma to
do this?  I forget.

However, if the array component subtype is controlled, I don't think there's
any way to turn of controlled initialization.  But I wouldn't think you'd
want to, either.

Is the array component subtype scalar?

Perhaps we could help you more if you provided the declarations of the array
component subtype and array subtype.








  parent reply	other threads:[~2002-10-17 13:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-17 12:55 Compiler default initialization of array types Sebastian
2002-10-17 13:10 ` Lutz Donnerhacke
2002-10-17 22:39   ` Peter Richtmyer
2002-10-17 13:42 ` Matthew Heaney [this message]
2002-10-17 23:57   ` Robert A Duff
2002-10-18  9:50     ` Larry Kilgallen
2002-10-18 14:40       ` Robert A Duff
2002-10-18 15:04         ` Larry Kilgallen
2002-10-18 13:36     ` Matthew Heaney
2002-10-18 15:28     ` Wes Groleau
  -- strict thread matches above, loose matches on Subject: below --
2002-10-17 14:23 Grein, Christoph
replies disabled

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