In article <11**********************@y80g2000hsf.googlegroups .com>,
<fr*********@gmail.comwrote:
>Exec_Mem(unsigned long address)
{
void (* foo) () = void (*) () address; <-----?
foo ();
}
>I understand that foo is a function pointer of type void, but what is
the right hand side of the equation - some kind of cast? Can somebody
elaborate for me?
Yes, it is a cast of the address to become a pointer to a function
returning void.
The casting of a integral value into a pointer to an object type
is implementation defined. The casting of a numeric value
into a pointer to a function type is undefined in the C89 standard,
but it is not a constraint violation so particular implementations
can do whatever they want with it (possibly even something useful.)
The code you have found uses non-standard extensions and is
decidedly not portable.
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest