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:32:56 PST Path: news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread4.news.pas.earthlink.net.POSTED!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How to Emulate C++ Macro with Static Local Variable? References: <3F73107A.1060502@attbi.com> <04Hcb.577973$Ho3.106182@sccrnsc03> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Tue, 30 Sep 2003 01:32:55 GMT NNTP-Posting-Host: 63.184.1.74 X-Complaints-To: abuse@earthlink.net X-Trace: newsread4.news.pas.earthlink.net 1064885575 63.184.1.74 (Mon, 29 Sep 2003 18:32:55 PDT) NNTP-Posting-Date: Mon, 29 Sep 2003 18:32:55 PDT Xref: news1.google.com comp.lang.ada:257 Date: 2003-09-30T01:32:55+00:00 List-Id: taashlo@sandia.gov wrote: > Jeffrey Carter writes: > >>>1) Use a unique ID for each call. But this turns into a maintenance >>>nightmare when you get a few hundred calls or more. >>>2) Use the return address of the call. But there was a short >>>discussion >>>about how Ada doesn't currently have a way of accessing the return >>>address of a subprogram. >> >>3. Use a unique instantiation of a generic package for each call. The >>instantiations of the package must be at a nesting level that ensures >>that they will exist for the entire lifetime of the executable region >>in which they are used. > > Won't a unique instantiation require a unique name? This is the same > problem with item 1) above. A single unique instantiation is no > problem, but try a thousand instantiations whose associated function > calls are scattered across fifty files. Where using the wrong > instantiation can lead to subtle and difficult-to-reproduce errors. > This is not a solution that I'd voluntarily aim for. We've gone from hundreds to thousands now? I can play that game, too. If you use millions of identical calls in your code, no one can maintain it, no matter what language or technique you use. There are significant differences between using a unique ID and a unique 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 call, and that, of course, is true regardless of the technique used. With a good process for choosing the next instantiation name, you'll never create a problem. 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 knowledge, we can't really tell how to advise you. -- Jeff Carter "You've got the brain of a four-year-old boy, and I bet he was glad to get rid of it." Horse Feathers 47