Not sure if this belongs in the Programmers Corner or here. But since it is the XC8 compiler I figured I would put it here.
I am getting a Can't generate code for this expression in the following code:
If I make my return type an int then everything compiles OK. Or if I do not have any parameters and a void return type for the callback function then it compiles.
This compiles with the corresponding correction to the call to the callback.
typedef void (*OW_update_cb)();
This also compiles just fine.
typedef int (*OW_update_cb)(unsigned int count);
Any idea what is going on? I have not used callback functions all that much.
I am getting a Can't generate code for this expression in the following code:
Rich (BB code):
typedef void (*OW_update_cb)(unsigned int count);
void foo(OW_update_cb update_cb)
{
update_cb(0); // Error occurs here
}
This compiles with the corresponding correction to the call to the callback.
typedef void (*OW_update_cb)();
This also compiles just fine.
typedef int (*OW_update_cb)(unsigned int count);
Any idea what is going on? I have not used callback functions all that much.