Basically I am asking for a translation of:
GCC does not use the latitude given in C99 only to treat certain aspects of signed `<<' as undefined, but this is subject to change.
(GCC 4.8.1 manual, paragraph 4.5)
What 'latitude' is given? Which certain aspects?
Other answers have already pointed out which aspects of <<
are undefined behavior. My guess is that you want a "translation" of the gcc into common language.
If a behavior is undefined by the C standard, compiler implementors can take the "latitude" to do anything that suits them if such a case occurs. In particular, they don't have to implement a diagnostic or detection of that case, and may pretend that it never happens. It is the responsability of the programmer to write his program such that its behavior is always defined.
In the case of left shift, this means that a compiler would not have to check for overflow and can pretend that a loop like
for (int i = 1; i > 0; i <<= a) {
.... change a in some complicated way ...
}
would never terminate.
The sentence that you are citing indicates that they don't do such a thing, yet, but that future versions of gcc might do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With