This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: is casting of function descriptor assignments for ia64 ONLY a good idea?
- From: Martin Kahlert <martin dot kahlert at infineon dot com>
- To: Keith Owens <kaos at sgi dot com>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 3 Jan 2002 10:25:23 +0100
- Subject: Re: is casting of function descriptor assignments for ia64 ONLY a good idea?
- References: <20020102214635.A2607@sgi.com> <16069.1010046930@ocs3.intra.ocs.com.au>
- Reply-to: martin dot kahlert at infineon dot com
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.