This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Comparing function pointers

// Hi,

//first: create a function typedef of void(void)
typedef void(*myFunctionType)(void);

//second: declare some functions
void vTst000(void){}
void vTst001(void){}
void vTst002(void){}

//third: create pointers to these functions
myFunctionType pntTst000=vTst000;
myFunctionType pntTst001=vTst001;
myFunctionType pntTst002=vTst002;

// My question is this:
//
// Is it ALWAYS true when comparing two pointers to two different functions
// that the pointer belonging to the LATER declared function always contains
// a HIGHER (address)value than the pointer belonging to an EARLIER
// declared function?
//
// For example:
//
// Does this always evaluate to 'true'?
//
// if ( pntTst002 ) > ( pntTst000 ) {}
//
//
// I need this functionality for running a statemachine stepping
// through different states and I need to know if the current
// selected state (to be executed) points to a later or an
// earlier previous executed state-function.
//
// Thanks
//
// Henk

Parents
  • // My question is this:
    //
    // Is it ALWAYS true ...

    No.

    // I need this functionality for running a statemachine stepping
    // through different states and I need to know if the current ...

    Then store the function addresses in an array of function pointers in the order you require and use the array element addresses for comparison.

Reply
  • // My question is this:
    //
    // Is it ALWAYS true ...

    No.

    // I need this functionality for running a statemachine stepping
    // through different states and I need to know if the current ...

    Then store the function addresses in an array of function pointers in the order you require and use the array element addresses for comparison.

Children