develooper Front page | perl.perl5.porters | Postings from September 2003

Re: Interesting - [ A user's experiences with GCC-3.4 snapshots]

Thread Previous | Thread Next
Andy Dougherty
September 17, 2003 17:27
Re: Interesting - [ A user's experiences with GCC-3.4 snapshots]
Message ID:
On Tue, 16 Sep 2003, Chip Salzenberg wrote:

> According to Enache Adrian:
> > Just a cast to void* 'if ((void*)&func) ...' will probably get this right --
> Unfortunately not.  You must cast, but void* isn't a portable choice.
> Function pointers are not guaranteed castable to any data pointer
> type, not even void*.  They're guaranteed castable among each other,
> though (as long as you get them back to their original types before
> calling through them (which we aren't doing anyway)).
> So this should be portable:
>    typedef void VFUNC();
>    if ((VFUNC*)func != (VFUNC*)main) { ... }
> PS: Note that the "&" before a function name is entirely unnecessary.

So it might seem, but it turns out that (for the existing test) the MPE/iX
linker gave Configure the wrong answer unless we used the '&'.  I'm
working on writing down this collected wisdom so we have a place to look
the next time gcc next breaks this test.

    Andy Dougherty

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About