comparing pointers to void functions
Bron Campbell Nelson
bron at bronze.wpd.sgi.com
Wed May 30 16:37:05 AEST 1990
In article <61180 at sgi.sgi.com>, rpw3 at rigden.wpd.sgi.com (Rob Warnock) writes:
> In article <9454 at pt.cs.cmu.edu> cycy at 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 at sgi.com or possibly ..!ames!sgi!bron
These statements are my own, not those of Silicon Graphics.
More information about the Comp.sys.sgi
mailing list