On 2 January 2016 at 13:26, Vincent Diepeveen wrote: > > Assuming function f() has been defined > Comparing 2 different types is undefined in C. That's completely untrue, I have no idea where you got that idea. Look up "integer promotion". > Note that compilers that optimize better than GCC, say intel c++ which is > 10% - 30% faster for many of my codes, statistical odds it goes wrong is > higher than GCC. Nonsense. > In assembler it could for example XOR just register ah, which is a 8 bits > register and then further you compare register aex with another value. > > So the other 24 bits of that register might have some random value. Nonsense. > In 64 bits it's even bigger problem also with gcc. > I write lots of 64 bits codes. > > unsigned long long x; > If( x == 0 ) // undefined behaviour also in GCC It's undefined behaviour because 'x' is uninitialized, but not because the types are different.