We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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(); }
Thank you! Then I better avoid using function pointers.
Not necessarily - just make sure that you fully understand the issues with function pointers in Keil C51 and follow the advice:
http://www.keil.com/appnotes/docs/apnt_129.asp
http://www.keil.com/support/docs/2429.htm
http://www.keil.com/support/docs/210.htm
http://www.keil.com/support/docs/2379.htm
http://www.keil.com/support/docs/1887.htm
http://www.keil.com/support/docs/1026.htm
http://www.keil.com/support/docs/996.htm