comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.leake@gsfc.nasa.gov>
Subject: Re: A little more data
Date: 1998/05/06
Date: 1998-05-06T00:00:00+00:00	[thread overview]
Message-ID: <3550AB69.1F6BCFD4@gsfc.nasa.gov> (raw)
In-Reply-To: 6iosig$3mp@bgtnsc01.worldnet.att.net


If this is an Ada 95 compiler (which I doubt, given the target), try
Pragma Preelaborate.

In Ada 83, there may be a compiler switch to cause pre-elaboration.

Or, if you can live with constant data, try declaring Scale_Factor to be
"constant".

-- Stephe

Kevin Wells wrote:
> 
> BTW - I'm using the EDS Ada compiler targeted for a 1750A processor
> hosted on a DEC Alpha platform. If anyone needs any code snippets to
> help me out, let me know...
> 
> Thanks again,
> Kevin Wells
> 
> Kevin Wells wrote:
> 
> > When specifying data in an Ada package that is pre-initialized such as
> > ----------------------------------------
> > package Generate_Matrix is
> >   Scale_Factor : float := 10.903;
> >   .
> > end Generate_Matrix; -- spec
> > ----------------------------------------
> >
> > 1. Is it normal for the compiler to generate code that sets the value in
> > memory
> >     (that gets executed when the runtime system is initialized)?
> > 2. Is there a way to get around this?
> >
> > I am trying to create pre-initialized data arrays in memory such as
> > ----------------------------------------
> > type Array_Type is array (1 .. 5) of integer;
> > Small_Array : Array_Type := (1, 10, 5, 9, -50);
> > ----------------------------------------
> > but the compiler generates a bunch of code to set those 5 memory
> > locations.
> > (The actual code generated is about 3 to 5 times the size of the data
> > area
> > of the array). This really isn't a problem, except we only have a 64K
> > machine
> > with about 48K of it being used already. To make matters worse, a
> > reserve
> > of about 25% must be maintained for future changes. (That leaves me with
> >
> > about 0 words of memory to add things :) ) I have about 3100 words of
> > data that is initialized at compile time.
> >
> > I have been coding for about 7-1/2 years now. The first 5-1/2 developing
> > C
> > and assembly applications..only the last 2 have been in Ada. I feel I
> > know Ada
> > pretty good (and I really appreciate the 'control' it gives me in
> > developing
> > safe and tolerant code over other langauges). However, I'm not too sure
> > about how to handle this - In C, a seperate 'pre-initialized data
> > segment was
> > kept separately (along with other segments).
> >
> > Does anyone have any ideas or suggestions about doing this that fits
> > within
> > Ada's elegant realm of development (No external overlays) and allows the
> >
> > actual preinitialized data (without the code) to be saved in the final
> > executable?
> >
> > Thanks much,
> > Kevin Wells, Software Engineer, Boeing
> > wellsk@netcom.com




  reply	other threads:[~1998-05-06  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-05  0:00 Initialized global data Kevin Wells
1998-05-05  0:00 ` A little more data Kevin Wells
1998-05-06  0:00   ` Stephen Leake [this message]
1998-05-06  0:00 ` Initialized global data Anonymous
1998-05-08  0:00   ` Simon Wright
1998-05-08  0:00     ` Tucker Taft
1998-05-09  0:00       ` Simon Wright
1998-05-10  0:00         ` Robert Dewar
1998-05-11  0:00           ` Simon Wright
1998-05-11  0:00             ` Matthew Heaney
1998-05-06  0:00 ` John English
1998-05-06  0:00 ` Tucker Taft
1998-05-09  0:00 ` Niklas Holsti
replies disabled

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