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

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.  Perhaps a virtual function to return the type of
the feeder, as a string?  (Essentially manual RTTI, for feeders only.)

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

By the way, the reason I'm trying to avoid that variable (and extra members
in general) is a lot of special-purpose member variables make it take longer
for people to figure out these classes.  (A class with two member variables
and a hundred member functions is a lot simpler than one with two member
functions and a hundred member variables.)  If a variable is needed, it's
needed--but it's worth exploring alternatives where they look reasonable.

Anyhow, I've long since learned not to code at 5am.  Good night. :)

-- 
Glenn Maynard

Reply via email to