6 ms·
Is there a cleaner/more idiomatic way to do this? I'm afraid this is the C idiom for assigning a void pointer to a function pointer: *(void **) &fptr = getv
by ucs 10y ago
Is there a cleaner/more idiomatic way to do this?
I'm afraid this is the C idiom for assigning a void pointer to a function pointer:
*(void **) &fptr = getvoidptr();
Without the silly cast you'd get the following warning when compiling with -Wpedantic:
warning: ISO C forbids assignment between function pointer and 'void *'
Once you learn the idiom, and the reason behind it, it makes things (slightly) easier to parse than dealing with a bunch of typedefs, IMHO.