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,28a3f8dc0fa9d6ac X-Google-Attributes: gid103376,public From: "Corey Ashford" Subject: Re: STATIC Variables Date: 1998/07/23 Message-ID: <6p6s84$klg$1@usenet.rational.com>#1/1 X-Deja-AN: 374115142 References: <35B6EC76.ED3B1493@infaut.et.uni-magdeburg.de> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Rational Software Newsgroups: comp.lang.ada Date: 1998-07-23T00:00:00+00:00 List-Id: Marc Enzmann wrote in message <35B6EC76.ED3B1493@infaut.et.uni-magdeburg.de>... >Does Ada have an equivalent to C's STATIC declaration ? >I've found this to be very helpful in some signal-processing >and simulation algorithms. >I've thumbed through a number of Ada textbooks but didn't find >anything. >Any hints ? > >Thanks, > >Marc >-- You might want to use www.dejanews.com to look through past responses to this question. The standard answer is usually to wrap a package around the function, and place the static variable within the package. This slightly complicates calling the function, but you could use a library level wrapper function to make the package invisible. e.g. package foo is function bar (x:integer) return integer; end foo; package body foo is var : integer; function bar (x:integer) return integer is begin var := var + 1; ... return factorial(var) * x; end bar; end foo; function wrapped_bar (x: integer) return integer is begin return foo.bar(x); end wrapped_bar; - Corey