From: Jan W. <we...@ef...> - 2010-07-29 08:08:43
|
I believe the less-optimised version simply performs the multiplication in hardware and then interprets the result as signed int. The optimiser has more space to "think", thus "knows" that the result is undefined and uses thus some suitable constant (zero?). I would like to see uint64_t(vus * vus) printf'd (along with sizeof(int) and sizeof(short)) in the different cases. JW ----- Original Message --------------- >Jan, > >thank you for the explanation. The strange thing is (but you explained >it is valid) that the same compiler behaves differently depending on >optimization options. > > >This means that the regtest > >volatile unsigned short vus = 0xfffe; >assert (vus * vus< 1); > > >is implementation dependent, so it should be removed. > >Borut > |