Re:GCC 6.1 Released
by Kristine1975 on Wednesday April 27, 2016 @12:44PM
(#11582101)
>And, maaaaaaybe signed integer overflow.
Overflow checking is sometimes done like this (where a is a signed integer):
if (a + 100 < a) ...
Of course this invokes undefined behavior, and some people get angry when compilers remove the check: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475
Re:GCC 6.1 Released
by anttihaapala on Thursday April 28, 2016 @04:46AM
(#11587325)
And of course the code is wrong, because the behaviour is undefined - in 64-bit architectures it is very common to use 64-bit registers for `int` even if in memory `sizeof(int) == 4`; thus `int a = INT_MAX;`, `a + 100` could still be greater than `INT_MAX`.
The rest are clearly taught in CS100 to be doorways to chaos. In particular, complaining that volatile doesn't get rid of the need for locks is just making noise. Might as well complain that auto doesn't get rid of the need for locks. They are both unrelated to threading.