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
Chip Salzenberg
September 16, 2003 17:51
Re: Interesting - [ A user's experiences with GCC-3.4 snapshots]
Message ID:
According to Mark-Jason Dominus:
> I suggested (setproctitle!=main) because it seemed to me that there
> was no way any compiler could possibly optimize away the comparision:

I agree.  OTOH, I don't think this works:

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

I don't believe that works; data pointers and function definitions
don't work the same.  In fact, I don't believe there's any way in
standard C to arrange for &func1 == &func2.

OTGH, you can do it in assembler easily enough, and the compiler can't
know that you haven't.  So the equality test is a Good Idea.
Chip Salzenberg               - a.k.a. -               <>
"I wanted to play hopscotch with the impenetrable mystery of existence,
    but he stepped in a wormhole and had to go in early."  // MST3K

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