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

Recursive Call Warning? Why?

Hi,

please can someone try this little code snippet with the C51 compiler and tell me why I am getting a "Linker Warning L13: Recursive Call to Segment Foo1, Caller: Foo2"

void foo1(void);
void foo2(void);

void (*function_pointer)(void) = &foo1;


void set_function(void(*p_function_pointer)(void))
{
  function_pointer = p_function_pointer;
}

void execute(void)
{
  (*function_pointer)();
}

void foo1(void)
{
  set_function(&foo2);
}

void foo2(void)
{
  bit Linker_Warning_Comes_With_Definition_Of_This_Bit;
  set_function(&foo1);
}

void main()
{
   execute();
}