comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: How to Emulate C++ Macro with Static Local Variable?
Date: Tue, 30 Sep 2003 01:54:57 GMT
Date: 2003-09-30T01:54:57+00:00	[thread overview]
Message-ID: <Rn5eb.639637$uu5.102600@sccrnsc04> (raw)
In-Reply-To: b35eb.8293$RW4.197@newsread4.news.pas.earthlink.net

>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.



  reply	other threads:[~2003-09-30  1:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-24 22:06 How to Emulate C++ Macro with Static Local Variable? taashlo
2003-09-24 23:44 ` Robert I. Eachus
2003-09-25  3:27   ` Hyman Rosen
2003-09-25  4:53     ` tmoran
2003-09-25 15:57       ` Robert I. Eachus
2003-09-25 19:09         ` tmoran
2003-09-29 14:57           ` taashlo
2003-09-29 18:12             ` Jeffrey Carter
2003-09-29 18:51               ` taashlo
2003-09-30  1:32                 ` Jeffrey Carter
2003-09-30  1:54                   ` tmoran [this message]
2003-09-30 13:02                   ` taashlo
2003-09-30 20:25                     ` Jeffrey Carter
2003-09-30  2:45             ` Robert I. Eachus
2003-09-30  3:24               ` tmoran
2003-09-25 13:43     ` Stephen Leake
2003-09-25 12:59   ` Tad Ashlock
2003-09-25 16:11     ` Robert I. Eachus
2003-09-25 18:13       ` Randy Brukardt
2003-09-25 23:40         ` Robert I. Eachus
2003-09-25 11:54 ` Gautier
2003-09-25 16:14   ` Robert I. Eachus
2003-09-25 18:06   ` Tad Ashlock
2003-09-28  8:42     ` Gautier Write-only
2003-09-28 20:06       ` Jeffrey Carter
2003-09-29  2:13         ` Gautier Write-only
2003-09-25 13:41 ` Stephen Leake
2003-09-25 17:23   ` Tad Ashlock
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox