From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,25e7db2f1ea1e260 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Constants: how are they allocated? Date: 1996/05/06 Message-ID: #1/1 X-Deja-AN: 153309579 references: <4ml2s6$bis@dewey.csun.edu> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-05-06T00:00:00+00:00 List-Id: In article <4ml2s6$bis@dewey.csun.edu>, justin gombos 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