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 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-29 18:54:57 PST Path: news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc04.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: How to Emulate C++ Macro with Static Local Variable? References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.124.41 X-Complaints-To: abuse@comcast.net X-Trace: sccrnsc04 1064886897 12.234.124.41 (Tue, 30 Sep 2003 01:54:57 GMT) NNTP-Posting-Date: Tue, 30 Sep 2003 01:54:57 GMT Organization: Comcast Online Date: Tue, 30 Sep 2003 01:54:57 GMT Xref: news1.google.com comp.lang.ada:268 Date: 2003-09-30T01:54:57+00:00 List-Id: >instantiation name. With IDs you have to add new IDs and modify the code >that interprets the ID as well as insert the new call for a new >location. With an instantiation you add the new instantiation and the >new call. You need never touch the existing code except to delete a With instantiations, he must add at a global level procedure log872 is new log; and then in his code insert a call to "log872;" If he's doing that, why not simply cache: array(1 .. 872) of cached_data_type; and cache(872) := stuff; >All this is sort of irrelevant, though. We don't know what you're trying >to accomplish, just a technique you're trying to use. Without that A not necessarily portable, but probably works, method of course is to raise a dummy exception occurrence and parse the exception information for a file/line number, ie, a static location in the source code. Certainly it's very questionable to use a static code location as a key for a cache database. I'd agree that a function ought to maintain its own cache invisibly to the outside world, just like any other part of its internal algorithm. But my example of the log that keeps track of code usage is an (admittedly stretched) example of a use for the static location information.