On Tue, Jul 24, 2001 at 01:58:56PM +0400, Alexander V. Lukyanov wrote:
> I don't see how it could be broken. if QueueFeeder ever finishes and
> is removed, no other feeder can be added (there is no code for that),
> and the CmdExec will be deleted very soon, because it is Done().

It's not done *yet*.  The issue is that it's a subtle assumption (unless
you've either wrote it yourself or have stared at the code long enough
to see it, or stumbled upon a comment explaining it); someone might try
putting a feeder on top of queues, or moving feeders around, and this'll
break.

Actually, since it'd still be casting the feeder to a QueueFeeder,
dynamic_cast<> would be a safeguard (if it happened, it'd throw), but,
er, that requires both RTTI and exceptions.  No matter, I have another
idea ...

> > Perhaps a virtual function to return the type of
> > the feeder, as a string?  (Essentially manual RTTI, for feeders only.)
> 
> That would be overkill.

Well, a one-line function per feeder, but ...

Anyhow, this isn't really an issue worth another day of deliberation. :)
Here's a better idea: change is_queue to has_queue, of type QueueFeeder.
If there's a queue, it points to it; if not, it's NULL.  No extra code,
no assumptions, and no RTTI.

-- 
Glenn Maynard

Reply via email to