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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,196864e6c216ca4f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-25 04:54:43 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: gautier_niouzes@hotmail.com (Gautier) Newsgroups: comp.lang.ada Subject: Re: How to Emulate C++ Macro with Static Local Variable? Date: 25 Sep 2003 04:54:42 -0700 Organization: http://groups.google.com/ Message-ID: <17cd177c.0309250354.77444ccd@posting.google.com> References: NNTP-Posting-Host: 213.173.163.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1064490883 1585 127.0.0.1 (25 Sep 2003 11:54:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 25 Sep 2003 11:54:43 GMT Xref: archiver1.google.com comp.lang.ada:42889 Date: 2003-09-25T11:54:43+00:00 List-Id: Something like that: with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; procedure Test_Static_in_generic is type S is array(0..7) of Integer; generic foo: Integer; package P is procedure BAR; end; package body P is initialized: Boolean:= False; cache: S; procedure BAR is begin if not initialized then cache:= (others=> foo); initialized:= True; end if; Put(cache(cache'last)); end; end; package P10 is new P(10); package P20 is new P(20); package P30 is new P(30); begin for count in 1..4 loop for i in 1..3 loop case i is when 1=> P10.BAR; when 2=> P20.BAR; when 3=> P30.BAR; end case; end loop; New_Line; end loop; end; ? BTW: what this solution with pointers is about ?! ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site!