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,a327d56b3d5e9a4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-13 06:59:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Booch: iterator invalidation Date: 13 Nov 2002 09:56:43 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <3dcbb4e4$0$299$bed64819@news.gradwell.net> <3dd1d172$0$307$bed64819@news.gradwell.net> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1037200058 28351 128.183.235.92 (13 Nov 2002 15:07:38 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 13 Nov 2002 15:07:38 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:30807 Date: 2002-11-13T15:07:38+00:00 List-Id: porton@ex-code.com (Victor Porton) writes: > In article , > Stephen Leake writes: > > I've used "debug storage pools" that report statistics on > > allocations/deallocations. I guess that is a form of what you are > > talking about here. > > Yes, it is of such kind. Ok. In that particular case, the "real code" was not affected. Well, I had to add a generic parameter for the storage pool, but I convinced myself that was a "good thing" anyway :). > Also it may be e.g. back references from a container to iterators > for checking validity etc. Ah. That makes sense. I wonder if you can do that via a storage pool? I guess there would have to be one pool per container, rather than per container type. > >> type T is T_Internal(Use_Debug); -- Use_Debug is a Boolean _constant_ > >> > >> Will this not bring "additional debugging stuff" in the release > >> version (when Use_Debug=False)? > > > > Now everything that uses T_Internal has to specify a Debug > > discriminant. To intrusive for my taste. > > It is meant for user code to use _only_ T, not T_Internal. > (In OO style T_Internal should be in private section.) Ok, that makes it better. But you'll need a wrapper around T_Internal to enforce that. I would still try to use gnatprep or some similar tool, so the "real code" does not have this "debug only" overhead. > All compiler implementors should consider this to ensure that > they have zero space-efficiency. I'm not clear what you mean here. I suppose if the compiler could prove that _every_ instance of T_Internal had the same value for Use_Debug, it could optimize stuff. But that seems like a lot of work. Any time T_Internal is passed as a subprogram parameter, you'd either have to inline the subprogram or do full data-flow analysis. -- -- Stephe