comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Constants: how are they allocated?
Date: 1996/05/06
Date: 1996-05-06T00:00:00+00:00	[thread overview]
Message-ID: <Dqzvxp.MFo@world.std.com> (raw)
In-Reply-To: 4ml2s6$bis@dewey.csun.edu


In article <4ml2s6$bis@dewey.csun.edu>,
justin gombos <hbcsc096@csun.edu> wrote:
>Oops.. I botched on the question.  Let me re-word it.  If a constant is
>defined and allocated at runtime, where is it stored?  ie. in the case
>that a constant is assigned to a function or expression containing
>variables. 

In most compilers, such constants are allocated just like variables.
The fact that the thing is constant causes compile-time checks, and
might cause the optimizer to be more clever, but is unlikely to affect
storage allocation (I'm assuming the compiler doesn't know the value
here).

E.g if you put:

    X: constant Integer := Read_A_Value_From_The_Keyboard;

in a procedure, X will probably be allocated on the stack, just the same
as if X were not constant.

- Bob




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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-01  0:00 Constants: how are they allocated? Justin Gombos
1996-05-02  0:00 ` Chad Bremmon
1996-05-02  0:00 ` Theodore E. Dennison
1996-05-06  0:00 ` justin gombos
1996-05-06  0:00   ` Robert A Duff [this message]
1996-05-06  0:00     ` Theodore E. Dennison
1996-05-06  0:00   ` Theodore E. Dennison
replies disabled

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