Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!brutus.cs.uiuc.edu!usc!ucsd!ucbvax!RAND.ORG!salzman%iris From: salzman%iris@RAND.ORG (Isaac Salzman) Newsgroups: comp.soft-sys.andrew Subject: Re: WP bug on SPARC, new release version? Message-ID: <8911220012.AA02790@iris.rand.org> Date: 22 Nov 89 00:12:47 GMT References: <2657@auspex.auspex.com> Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 30 >(Actually, it's a bug in the WP code, which happens not to prevent it >from doing what you want on many C implementations, but the SPARC and >perhaps Pyramid C implementations are not among them; passing an object >of type "foo" to a routine expecting an object of a union type that >includes type "foo" is not valid C.) i didn't think it was valid C. defeinitely not code that i would write :-) (especially declaring the union as part of the paramater dec's - yech)! but since it worked under GCC on SPARC and both Sun's CC and GCC on the sun3.... >Is it ever the case that somebody passes something to "wp_DeAllocate" >and doesn't know which of the N flavors of things that "wp_DeAllocate" >can deallocate it is? If not, perhaps the best long-term fix is to >replace "wp_DeAllocate" with multiple deallocaters and call the correct >one in each instance, passing it a pointer to a "wp_PrimeKeySet" or to a >"struct wp_SrchToken". (I.e., does all the code that calls it passing >it a "struct wp_SrchToken *" really truly pass it a pointer to a >"wp_SrchToken", not a pointer to a "wp_PrimeKeySet" in disguise, and >*vice versa*?) i haven't explored the andrew code a whole lot. i do know that andrew uses (in some places) a classing mechanism. i guess it does not implement any sort of dynamic binding (aka virtual functions in C++). here's a good case for using an object system with dynamic binding. you wouldn't need to know which of the N flavors of an object something is. it's determined at runtime. just send the DeAllocate message (actually, just "delete" the object in C++ and the destructors get called automatically).... -isaac (salzman@rand.org)