I have following codes: void fun1(unsigned char *msg); void fun2() { fun1("ssss"); } void fun3() { } code void (*func_array[])()={fun2, fun3}; void fun1( unsigned char *msg) { (*func_array[1])(); } void main() { (*fun_array[0])(); } when compiling, i got the following message *** WARNING L13: RECURSIVE CALL TO SEGMENT SEGMENT: ?CO?HELLO Could you please tell me how to solve it? Thanks a lot!
Thank you all guys! I cut and paste part of my codes and solution here. HOPE that you still keep one eye on that, and any suggestion is very welcome! The situation is the codes are not only intended for C51, but also for other processor! I prefer a general structure for all platforms, and It seem that using two function pointer tables is a good way. Firstly, I have the following data structure for function pointer tables.
……. typedef Bool (*FnDrawing)(Void); typedef Void (*FnDrawed)(Void); typedef Bool (*FnProcessingKey)(Void); typedef Void (*FnProcessedKey)(Void); ………. typedef struct tagStruct { ………………….. FnProcessingKey fnProcessingKey; FnProcessedKey fnProcessedKey; FnDrawing fnDrawing; FnDrawed fnDrawed; ………………… } nuStruct; typedef nuStruct * RPnuStruct;
Code nuStruct MainStruct = { ………….. MainProcessingKey, MainProcessedKey, MainDrawing, MainDrawed, ……………………. }; Code nuStruct TnuStruct = { ………….., TProcessingKey, TProcessedKey, TDrawing, TDrawed, ……………… }; ……
Code nuStruct * Code c_nuTable[] = { ………………. &MainnuStruct, …………… &TnuStruct, ………….. };
It is a very trial task which costs me half a day, That is the cost of programming a '51 as if it were a PC. Erik