At 03:47 PM 5/11/99 -0700, you wrote:
>a function pointer is (as should be obvious from the phrase) a pointer.  so
>by declaring "Boolean oldTrap(FieldPtr, EventPtr);" you have already made
>oldTrap be a pointer.  so sticking that extra "*" in the declaration of
>oldTrap is what's hosing you, because it turns "oldTrap" into a pointer to a
>pointer to a function, which is not what you want.

Some intermediate C:

Z RealFunction(X, Y);   // declares a FUNCTION called "Function"
                                // that takes 2 arguments, an X and a Y
                                // and returns a Z.

Z (*DereferencedFunction)(X, Y);        // declares a POINTER TO A FUNCTION
                                        // that takes 2 arguments, an X and
                                        // a Y and returns a Z.


Doing this:

Blah(X x, Y y)
{
    DereferencedFunction = RealFunction;
    RealFunction(x, y);         // fine, but won't link
    DereferencedFunction(x, y); // should break in the compiler
    (*DereferencedFunction)(x, y);      // calls RealFunction and dies
                                        // (may get caught by the linker if it's
                                        // not stupid)
}

Reply via email to