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

Re: Interesting - [drow@mvista.com: Re: A user's experiences with GCC-3.4 snapshots]

Thread Previous | Thread Next
From:
Mark Jason Dominus
Date:
September 16, 2003 17:39
Subject:
Re: Interesting - [drow@mvista.com: Re: A user's experiences with GCC-3.4 snapshots]
Message ID:
20030917003937.2720.qmail@plover.com
"Marcus Holland-Moritz" <mhx-perl@gmx.net>:
> Almost any modification of the condition forces a linker error with
> ICC, e.g.:
> 
>   int main() { extern void *setproctitle(); if(&setproctitle+0) return(0); else return(1); }
> 
> or
> 
>   int main() { extern void *setproctitle(); if((int)&setproctitle) return(0); else return(1); }


A smarter compiler could conceivably optimize those away also. In
particular, the second one invokes implementation-defined behavior.

I suggested (setproctitle!=main) because it seemed to me that there
was no way any compiler could possibly optimize away the comparision:
it can't be sure that you won't later link in some separately-compiled
file that says

        extern int main();
        int (*setproctitle)() = main;


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About