Re: Arithmetic on function address
From: Alex Fraser (me_at_privacy.net)
Date: 04/23/04
- Next message: Ziggy: "Re: strange case of void main"
- Previous message: Eric Sosman: "Re: Arithmetic on function address"
- In reply to: Stephen Biggs: "Arithmetic on function address"
- Next in thread: Malcolm: "Re: Arithmetic on function address"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 23 Apr 2004 22:03:09 +0100
"Stephen Biggs" <Spammers@AreLowLifes.com-INVALID-MUNGED> wrote in message
news:c6bjka$sct$1@news2.netvision.net.il...
> Given this code:
> void f(void){}
> int main(void){return (int)f+5;}
>
> Is there anything wrong with this in terms of the standards? Is this
> legal C code? One compiler I'm working with compiles this quietly, even
> with the most stringent and pedantic ANSI and warning levels, but
> generates code that only loads the address of "f" and fails to make the
> addition before returning a value from "main".
Perhaps it optimised the addition away by moving f() ;).
- Next message: Ziggy: "Re: strange case of void main"
- Previous message: Eric Sosman: "Re: Arithmetic on function address"
- In reply to: Stephen Biggs: "Arithmetic on function address"
- Next in thread: Malcolm: "Re: Arithmetic on function address"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|