On Tue, Jul 24, 2001 at 04:51:43AM -0400, Glenn F. Maynard wrote:
> On Tue, Jul 24, 2001 at 11:34:18AM +0400, Alexander V. Lukyanov wrote:
> > rtti looks like voodoo to me. It is rarely needed but enlarges all
> > objects. It can be easily avoided.
>
> Did a bit of reading on this.  The only overhead (aside from a name and
> derivation table, which is tiny) is that typeid only works properly
> for polymorphic objects.  The type is stored along with the vtable.  (The
> behavior is defined for nonpolymorphic objects, but unintuitive--but that
> was precisely for this reason, to avoid having enlarging all objects.)

Ok, so only vtables are enlarged. That's much better.

> Anyhow, if you still don't want RTTI, then the next:
>
> > Searching for QueueFeeder is easy without rtti. Just check for is_queue and
> > the first feeder (last in chain) will be QueueFeeder if is_queue==true.
>
> Assuming the first feeder is a queue doesn't seem very robust; it's a very
> easy assumption to break.

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

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

That would be overkill.

> > You are right that feeder can be called to show its status in jobs. is_queue
> > can also be helpful for CmdExec to alter its status accordingly.
>
> Well, it can be done generically--allowing any feeder which can look ahead
> to output jobs, instead of a special case for queues.  Are there any other
> uses for is_queue?  It still doesn't seem necessary.

Currently CmdExec says 'Now executing:' if is_queue==true.

--
   Alexander.

Reply via email to