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

function pointer

hi all,

do you think i can work around function pointers as following:

extern void a(void);
extern void b(void);

void fptr(void *fp)
{
if (fp == a)
a();
if (fp == b)
b();
}

void main(void)
{
void *fp;
fp = (void *)a; //or b
fptr(fp);
}

Parents
  • Function pointers is a wonderful means of achieveing certain things on processors with a suitable architecture.

    Here in the '51 community we often see someone trying to force the '51 to "behave".

    Darn it, the '51 is NOT a PC. Accept the challenges/limitations or stick with your PC.

    Function pointers is a nightmare in the '51 architecture, not in Keil C.

    Erik

Reply
  • Function pointers is a wonderful means of achieveing certain things on processors with a suitable architecture.

    Here in the '51 community we often see someone trying to force the '51 to "behave".

    Darn it, the '51 is NOT a PC. Accept the challenges/limitations or stick with your PC.

    Function pointers is a nightmare in the '51 architecture, not in Keil C.

    Erik

Children
No data