Wednesday, May 16, 2012

C function pointers error storage class specified for parameter `type name'

I currently have a piece of code that I am working on using function pointers as callbacks. I am having trouble with an error from gcc stating "storage class specified for parameter `type name'" The relevant portion of code is:



error_t addCommand(uint8_t command, void  (*callback)(uint16_t,uint8_t)){


This is actually using the nesC language for TinyOS but it seems to be a C issue. In my research on the issue I have found suggestions mostly stemming from one of two issues:
1. Something wrong in a header (missing semicolon)
2. passing a function pointer with a static or volatile value (i.e.
void (*callback)(volatile int, uint8_t)



I have eliminated problem 1 as far as I can tell. Problem 2 is only an issue if uint16_t or uint8_t are static of volatile (I don't have much experience with these types). Any tips/answers on how to solve this issue are greatly appreciated.



Also, if anyone is familiar with nesC the exact code looks more like this:



command error_t CommandEngine.addCommand(uint8_t command, void  (*callback)(uint16_t,uint8_t)){


It may be possible that what nesC is adding to the C language causes this error but I don't think this is the case.





No comments:

Post a Comment