Bug with array of pointers to functions in Cosmic V4.5.5?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-07-25 7:24 PM
Posted on July 26, 2007 at 04:24
Bug with array of pointers to functions in Cosmic V4.5.5?
Labels:
- Labels:
-
Legacy Products
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-07-22 5:27 PM
Posted on July 23, 2007 at 02:27
I think I may have found a bug in the Cosmic compiler V4.5.5. This indirect call with one parameter compiles perfectly:
******************************* int FunctionOne(unsigned int x) { } void main(void) { int FunctionOne(unsigned int); const int (*jumpTable[])(unsigned int) = { &FunctionOne }; jumpTable[0](1); } ******************************* But, when you add another parameter, the compiler says ''invalid indirect call'': ******************************* int FunctionTwo(unsigned int x, unsigned int y) { } void main(void) { int FunctionTwo(unsigned int, unsigned int); const int (*jumpTable[])(unsigned int, unsigned int) = { &FunctionTwo }; jumpTable[0](1, 2); } ******************************* Am I doing something wrong? -DavidOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-07-23 9:33 PM
Posted on July 24, 2007 at 06:33Hello, static memory models and functions called by pointer do not work well together: if you limit the arguments at 2 bytes it will still do because the arguments are passed in registers, but if you need more you must declare the called function @stack (or use a non static memory model). Regards, Luca (Cosmic)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-07-25 7:24 PM
Posted on July 26, 2007 at 04:24
Thank you!
