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-24 21:53:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!news.litech.org!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!attla2!ip.att.net!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc51.ops.asp.att.net.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: rwcrnsc51.ops.asp.att.net 1064465582 12.234.124.41 (Thu, 25 Sep 2003 04:53:02 GMT) NNTP-Posting-Date: Thu, 25 Sep 2003 04:53:02 GMT Organization: Comcast Online Date: Thu, 25 Sep 2003 04:53:02 GMT Xref: archiver1.google.com comp.lang.ada:42875 Date: 2003-09-25T04:53:02+00:00 List-Id: >The whole design is wrong in the C++ to begin with. If you want to have >a memoizing function, the job of caching old values belongs to the function >itself, not scattered in macros and variables all over the place. I quite agree. And I don't understand how the "procedure Subp" is supposed to be used. The OP does raise an interesting question, though. Essentially he wants to create an array indexed by particular ranges of the Instruction Counter, and he doesn't want the trouble or error-proneness of having to include specific marker code (eg, Where_I_Am := 27; or Saved_Info(72) :=...) type code to mark different areas with unique numbers. I don't see how one might do that without a preprocessor, and I don't see how one could (portably) get hold of the Instruction Counter for storage and later comparison, in Ada code. In the presence of tasking of course, it would be disaster waiting to happen anyway.