comp.lang.ada
 help / color / mirror / Atom feed
From: Craig Allen <cpallen@my-deja.com>
Subject: Ada version of C's 'static'
Date: 1999/07/19
Date: 1999-07-19T00:00:00+00:00	[thread overview]
Message-ID: <7n03us$862$1@nnrp1.deja.com> (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.




             reply	other threads:[~1999-07-19  0:00 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-19  0:00 Craig Allen [this message]
1999-07-19  0:00 ` Ada version of C's 'static' 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         ` Rod Chapman
1999-08-04  0:00           ` Robert Dewar
1999-08-04  0:00           ` Larry Kilgallen
1999-08-04  0:00             ` Robert Dewar
1999-08-04  0:00             ` Marin David Condic
1999-08-04  0:00               ` Robert Dewar
1999-08-04  0:00               ` Larry Kilgallen
1999-08-04  0:00         ` Chris Miller
1999-08-05  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
replies disabled

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