Given the following declaration for a function used to update a node in a doubly linked list:
uint8 dl_update(DL_LIST **node, uint16 new_tag, void *new_object,
uint32 new_size, void (*destructor)(void*))
And the following call to that function:
dl_update(&dlt_list, _TAG, zulu, sizeof(*zulu),
(void(*)(void*)) &_free_dlt_object(delta));
What about the last argument would cause the compiler to emit the error message "lvalue required as unary '&' operator"? The destructor function I am passing (and the structure it operates on) are defined as follows:
typedef struct DLT_OBJECT {
char *word;
uint8 number;
} DLT_OBJECT;
void _free_dlt_object(DLT_OBJECT *object) {
free(object->word);
free(object);
}
The following question seems to imply that its okay to cast a function pointer, so I do not believe that my doing so is causing the problem, although given that my code is running on a bare metal embedded system (listed as a possible gotcha in the question) I am not sure.
Is this a case of a simple grammatical error, or is it more of a structural problem? I have been operating under the impression that declaring function pointers with void pointer arguments was a good way of passing generic function pointers around to other functions...