[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

a few things to fix & gdb



Date: Sun, 23 Dec 90 09:49:52 PST
   From: xanadu!roger (Roger Gregory)


	   From vlad!mark Sat Dec 22 19:37:11 1990
	   Those should already be being printed (by foo's printOn) by using the
	   various overloadings of operator<<, which should each be already
	   checking for NULL before calling printOn in turn.  I just checked in
	   my old copy of tofux.cxx, and it seems that we are already doing this
	   correctly for all the variety of pointers to Tofus.  So I don't
	   understand where you are running into a problem.

   There are lots of printOn routines that aren't in tofu and they mostly
   don't check for NULL

   void RegionLayout::printOn (ostream& oo){
	   oo << this->getCategory()->name() << "(" << myRegion << ")";
   }
   is the first such example I run across in FM.

   unless passing a NULL gets the right superclass (which would surprise me a lot)
   this will blow up.

No it won't.  The reason (as I attempted to explain above) is that
"RegionLayout::printOn(..)" isn't directly calling
"myRegion->printOn(..)", but rather "oo << myRegion".  This will
invoke one of the overloadings of operator<< for one of the kinds of
pointers to Tofus, all of which seem to go through the proper NULL
check before conditionally calling myRegion->printOn(..).  Clear?

I wonder if your problem is simply the result of some relevant printOn
calling printOn on one of its members-which-may-be-NULL directly,
instead of going through operator<<.