Comparing GCC and Clang security features
Comparing GCC and Clang security features
Posted Sep 16, 2019 7:10 UTC (Mon) by neilbrown (subscriber, #359)In reply to: Comparing GCC and Clang security features by ballombe
Parent article: Comparing GCC and Clang security features
> declare each integer type separately
These attributes are attributes of the integer operation, not of the integer itself - a bit like 'volatile' which Linus has ranted about.
Maybe it would be even better to think of them as attributes of the assignment.
a = b + c
traps on overflow.
a @= b+c
wraps if b+c overflowed (the symbol has a wrapping around it)
a #= b + c
saturates on overflow (the remnant of the real value gets hashed out)
if you try (b + c) * x you always get a trap, because overflow is mostly bad.
Of course, you could always do
(_tmp @= b+ c) * x
if you really want to wrap a nested expression.