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

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

Thread Previous | Thread Next
From:
Chip Salzenberg
Date:
September 16, 2003 17:51
Subject:
Re: Interesting - [drow@mvista.com: A user's experiences with GCC-3.4 snapshots]
Message ID:
20030917005201.GC15294@perlsupport.com
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. -               <chip@pobox.com>
"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


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