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,cef1968b544ddf26 X-Google-Attributes: gid103376,public From: jsa@alexandria (Jon S Anthony) Subject: Re: Static variables? Date: 1997/03/18 Message-ID: #1/1 X-Deja-AN: 226280052 Distribution: world References: <332D71FF.4773@cae.ca> Organization: PSI Public Usenet Link Newsgroups: comp.lang.ada Date: 1997-03-18T00:00:00+00:00 List-Id: In article <332D71FF.4773@cae.ca> Viqar Abbasi writes: > Is there a way to declare local variables in ADA subprograms to be > STATIC? That is, they retain the value that they had when the > subprogram was last exited. This may be in the FAQ (see: www.adahome.com for the FAQ). Just put the variable at the same or lower scope than the subprogram that is to use it. Typically this is at package level. Ex.1: procedure P is V : Some_Variable_Type ... procedure Sub_P is ...-- V works as you wish for all invocation of Sub_P end Sub_P; ... end P; Ex.2: package P is V: Some_Variable_Type .... procedure P1 ... procedure P2 ... ... -- V works as you wish for all invocations of any Px here -- (also for any subprograms in the body of P and any child unit -- of P or, for that matter, any importer of P (with P...) end P; /Jon -- Jon Anthony Organon Motives, Inc. Belmont, MA 02178 617.484.3383 jsa@organon.com