Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!decwrl!sgi!bron@bronze.wpd.sgi.com From: bron@bronze.wpd.sgi.com (Bron Campbell Nelson) Newsgroups: comp.sys.sgi Subject: Re: comparing pointers to void functions Summary: void and void* in 3.2 have problems Message-ID: <61182@sgi.sgi.com> Date: 30 May 90 06:37:05 GMT References: <9454@pt.cs.cmu.edu> <61180@sgi.sgi.com> Sender: bron@bronze.wpd.sgi.com Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 31 In article <61180@sgi.sgi.com>, rpw3@rigden.wpd.sgi.com (Rob Warnock) writes: > In article <9454@pt.cs.cmu.edu> cycy@isl1.ri.cmu.edu (Scum) writes: [edited to reduced bandwidth] > +--------------- > | ... I'm having a problem trying to > | determine if a pointer is pointing to a certain function. The pointer is > | defined as an element in a structure thusly: > | struct object { > | void (*formstart) (); > | } > | However, the compiler will not accept the following attempt to compare the > | pointer to the address of the function, even though when they are printed > | out, their values are the same: > | if (thing->formstart == bgnpolygon) > +--------------- > ... on the 3.2 C compiler that still gives the error you saw. > > On a 3.3 (to be released) compiler, neither version of either form gives > an error (and the generated code looks correct). So I guess it's "fixed > in some to-be-determined release"... The short answer is that the compilers used in the SGI 3.2 release had various sorts of problems with void and void* types. This is one of them. As Rob says, these problems are fixed in the 3.3 version, due out Real Soon Now. Casting the types to char*() to do the compare is a bit ugly, but I think it should work until 3.3 is available. -- Bron Campbell Nelson bron@sgi.com or possibly ..!ames!sgi!bron These statements are my own, not those of Silicon Graphics.