O3 versus O2 weirdness

barthek doli@ibt.com.pl
Mon Apr 16 14:56:00 GMT 2007


Eljay,
>
> Make sure you put in
> c[0]=konfig[i];
> c[1] = '\0';
> l=atoi(c);
Thanks for that comment!
I was hoping that char c[2]="" clears c for me.
>
> Maybe.  Did you have all the warnings turned on?
by means of -Wall ? yes, they were turned on

>
> But even with warnings turned on, C gives you plenty of rope to hang
> yourself.  (C++ gives you even more rope.  So you can hang yourself, all
> your friends, family, co-workers, and still have enough rope left over to do
> the rigging of a small schooner.)

hehehhee thats a remarkable comment :))) guess thats why so many
people switch to other languages!

> Which one is "wrong" depends on whether foo expects a pointer to a character
> (in which case they're all "right"), or foo expects a pointer to a character
> array that is terminated with a nul character (in which case the first one
> is incorrect in that it violates the API contract... but the compiler does
> not know that).

hmm
it seems that more aggressive optimisation triggers code bugs, maybe it 
could be used for bug finding itself ? 
I would probably not know there is a bug in my code (because it worked as 
expected for me) unless I used O3.

> I agree.  The sole consolation is "job security".  :-P
phew, thanks God i'm not a programmer! :P

Cheers!
B



More information about the Gcc-help mailing list