OK basically I have a (probably harmless) compiler warning that, for the sake of completeness, I would like to remove if possible (go easy on me please, I'm a newbie). The key bits are (I think) ...
The warning.
Code:
warning C4550: expression evaluates to a function which is missing an argument list
askfor_aux and askfor_aux_keypress functions (and keypress_h function?) declared in a .h include file.
Code:
extern bool askfor_aux_keypress(char *buf, size_t buflen, size_t *curs, size_t *len, char keypress, bool firsttime);
extern bool askfor_aux(char *buf, size_t len, bool keypress_h(char *, size_t, size_t *, size_t *, char, bool));
askfor_aux_keypress function defined.
Function defined, and assignment made of function pointer.
Code:
bool askfor_aux_keypress(char *buf, size_t buflen, size_t *curs, size_t *len, char keypress, bool firsttime)
{
... skip rest ...
askfor_aux function defined
Code:
bool askfor_aux(char *buf, size_t len, bool keypress_h(char *, size_t, size_t *, size_t *, char, bool))
{
... skip bits ...
keypress_h = askfor_aux_keypress;
Now the things I don't quite know are
1) What's happening with that "declare a function inside a function declaration" thing that seems to be going on with keypress_h?
And
2) The intermediate keypress_h function pointer seems to be used to make it easy to switch out askfor_aux_keypress with a different function to handle collecting keypresses. However there are no alternative functions so I guess I can just ditch that bit and use askfor_aux_keypress directly?
Oh, and like I asked at the top, 3) Why the warning, and can I get rid of it? (Other than just suppressing C4550 )
[EDIT]Coming to think of it the fourth thing I don't get is why the rather similar looking assignments like ...
Code:
ang_sort_comp = ang_sort_comp_hook_longs;
don't prompt the same compiler warning.
Code:
extern bool (*ang_sort_comp)(const void *u, const void *v, int a, int b);
Code:
static bool ang_sort_comp_hook_longs(const void *u, const void *v, int a, int b)
{
...