comp.lang.ada
 help / color / mirror / Atom feed
* Initialized global data
@ 1998-05-05  0:00 Kevin Wells
  1998-05-05  0:00 ` A little more data Kevin Wells
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Kevin Wells @ 1998-05-05  0:00 UTC (permalink / raw)



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





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~1998-05-11  0:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
1998-05-06  0:00 ` Initialized global data John English
1998-05-06  0:00 ` 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 ` Tucker Taft
1998-05-09  0:00 ` Niklas Holsti

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