"Bartc" <bc@freeuk.comwrote in message
news:nh******************@text.news.virginmedia.co m...
>I have a variable like this:
int *p;
Sometimes this points to an int location containing the address of a
void(void) function.
How can I cast it so that I can call that function?
I've tried casting to void **(void). The compiler keeps saying such a cast
is illegal.
(It should compile to something like this in x86 code:
mov esi,[p]
call [esi]
)
According to the C99 standard, it may be possible as a common extension:
"J.5.7 Function pointer casts
1 A pointer to an object or to void may be cast to a pointer to a function,
allowing data to
be invoked as a function (6.5.4).
2 A pointer to a function may be cast to a pointer to an object or to void,
allowing a function to be inspected or modified (for example, by a debugger)
(6.5.4)."
Show the actual code you are trying to use.
** Posted from
http://www.teranews.com **