comp.lang.ada
 help / color / mirror / Atom feed
* Ada version of C's 'static'
@ 1999-07-19  0:00 Craig Allen
  1999-07-19  0:00 ` David Botton
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Craig Allen @ 1999-07-19  0:00 UTC (permalink / raw)


I've written some code in a procedure that operates on a table of
constants.  The table is used only by that procedure.  Right now, I have
that table defined locally to that procedure.  I believe the table is
regenerated every time the procedure is called.

In C, I'd declare this table static in that function.  This would give
me static duration and block scope for that function.

I don't want to define this table at 'package scope', as only 1
procedure uses this table (and the values would be removed from the
code that uses them).  I would prefer not to build the table at
elaboration time, because I'd like the definition to be close to the
code that's using it, not at the bottom of the package.

In short, this is exactly what I want, except in Ada.

void foo(void)
{
   static const int bar[] = {1, 2, 3, 4, 5};
   ...
}

Or is there a 'more Ada' way of doing this?

Thanks for any help.
-Craig




Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




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

end of thread, other threads:[~1999-08-10  0:00 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-19  0:00 Ada version of C's 'static' Craig Allen
1999-07-19  0:00 ` David Botton
1999-07-20  0:00 ` Simon Wright
1999-07-23  0:00 ` Tucker Taft
1999-07-30  0:00   ` Craig Allen
1999-08-03  0:00     ` Compilers for VAX Was: " Erdelyi Gaspar
1999-08-03  0:00       ` Larry Kilgallen
1999-08-04  0:00       ` Robert Dewar
1999-08-04  0:00         ` Chris Miller
1999-08-05  0:00           ` Robert Dewar
1999-08-04  0:00         ` Rod Chapman
1999-08-04  0:00           ` Larry Kilgallen
1999-08-04  0:00             ` Marin David Condic
1999-08-04  0:00               ` Larry Kilgallen
1999-08-04  0:00               ` Robert Dewar
1999-08-04  0:00             ` Robert Dewar
1999-08-04  0:00           ` Robert Dewar
1999-08-04  0:00       ` Steve Doiel
1999-08-05  0:00         ` Robert Dewar
1999-08-05  0:00           ` Larry Kilgallen
1999-08-06  0:00             ` Robert A Duff
1999-08-06  0:00               ` Larry Kilgallen
1999-08-09  0:00                 ` Robert A Duff
1999-08-09  0:00                   ` Richard D Riehle
1999-08-09  0:00                     ` Tucker Taft
1999-08-10  0:00                     ` Robert A Duff
1999-08-08  0:00               ` Robert Dewar

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