is casting of function descriptor assignments for ia64 ONLY a good idea?

Martin Kahlert martin.kahlert@infineon.com
Thu Jan 3 01:25:00 GMT 2002


Hi Keith,

On Thu, Jan 03, 2002 at 07:35:30PM +1100, Keith Owens wrote:
> Not just ia64, powerpc 64 as well.  You are assuming that all pointers
> are the same format when that is not guaranteed by the C standard.  On
> most architectures they are the same, you can convert a function
> pointer to a void pointer and back again but it is not defined
> behaviour.

O.k., but how should i do it correctly?
e.g. dlsym gives a void* (i assume, that's true in all OSes).
Is it o.k. to cast this pointer to a function?
If i assign the result of dlsym to a function pointer,
is the cast down automagically (the way it works e.g. for double --> int)?

I remember an OS (Irix?), where i got a warning of the kind
'warning, assignment of a void pointer to function pointer'

Thanks,
Martin.

-- 
The early bird catches the worm. If you want something else for       
breakfast, get up later.



More information about the Gcc-bugs mailing list