??? 11/16/06 22:58 Read: times |
#128139 - Function pointers troublesome? How? Responding to: ???'s previous message |
Andy said:
Because, as I noted earlier, function pointers are troublesome to (most) 8051 'C' compilers: http://www.8052.com/forumchat/read.phtml?id=128066
With Keil at least, it should be possible (so long as you don't dynamically change the table) - but I stuck with the switch rather than leave any room for doubt with the function pointers. This is interesting. I've made lots of state machines driven by tables of function pointers without any hint of trouble. I also have a little task scheduler thingie that employs a "to do" list consisting of an array of pointers to the functions that need to be executed at any given time. That thing has never given me any trouble, either. I use Version 4.23 of the Archimedes 8051 C compiler, which I believe is an ancestor of the current Keil compiler. I wonder if that compiler somehow works better in this regard than others, or if maybe I have just been lucky somehow. When you say that function pointers are "troublesome", what exactly do you mean? -- Russ |