読者です 読者をやめる 読者になる 読者になる

main = 195;

main = 195;

It throws no exception in IA32 architecture.

Because 195 == 0xc3 means "ret" in IA32.

but,

char main = 195;

throws segmentation fault in my environment.

Because it is optimized.

We can control this exception by investing "volatile" attribute.

volatile char main = 195;

And then, we can make main return EXIT_SUCCESS.

volatile long long main = 0xc300000000b89090LL;

It means "nop;nop;mov $0x0,%eax;ret".

My environment is Debian GNU/Linux sid(unstable), cc(gcc) 4.3.3.