comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Booch: iterator invalidation
Date: 13 Nov 2002 09:56:43 -0500
Date: 2002-11-13T15:07:38+00:00	[thread overview]
Message-ID: <uel9p8qms.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3dd1d172$0$307$bed64819@news.gradwell.net

porton@ex-code.com (Victor Porton) writes:

> In article <uptta4kgc.fsf@gsfc.nasa.gov>,
> 	Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov> 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



  reply	other threads:[~2002-11-13 14:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-08 12:51 Booch: iterator invalidation Victor Porton
2002-11-08 13:26 ` Jeffrey Creem
2002-11-08 21:00   ` Randy Brukardt
2002-11-08 18:05 ` Victor Porton
2002-11-09 14:20 ` Simon Wright
2002-11-12 16:50   ` Stephen Leake
2002-11-12 18:28     ` Robert A Duff
2002-11-12 20:09     ` Simon Wright
2002-11-13 14:49       ` Stephen Leake
2002-11-12 17:42 ` Victor Porton
2002-11-12 20:11   ` Stephen Leake
2002-11-13  2:43 ` Victor Porton
2002-11-13 14:56   ` Stephen Leake [this message]
2002-11-13 15:40 ` Victor Porton
replies disabled

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