Hi
I have the following statement
#define STATIC ((void(*) (void *) 0)
Note the parentheses don't match here, I'll assume you mean
#define STATIC ((void(*) (void *)) 0)
A cast contains a type which is similar to a declaration without the
variable name. Consider where the variable name would go in a
corresponding declaration:
void(*var) (void *);
Why is it there? There simply isn't anywhere else it could go. This
declares var as a pointer to a function taking a void * argument and
returning void. I've preserved the spacing which turns out to be a bit
confusing, this would be better written as:
void (*var)(void *);
so your original #define might be better as
#define STATIC ((void (*)(void *)) 0)
The (void *) I understand as meaning a pointer to a void, so
(void *) 0
would be a void pointer to zero
the meaning of void(*) is stopping me.
The spacing makes it look like that but it isn't. Remembering the
declaration of var, the cast is to a pointer to a function taking a void *
argument and returning void. So the expansion of STATIC evaluates to a
null pointer of this type.
Note that as a separate issue (void (*))p is a valid cast, however the
inner parentheses are redundant and it is equivalent to (void *)p.
Lawrence