c - What aspects of signed left shift are undefined with GCC? -
basically asking translation of:
gcc not use latitude given in c99 treat aspects of signed `<<' undefined, subject change.
(gcc 4.8.1 manual, paragraph 4.5)
what 'latitude' given? aspects?
other answers have pointed out aspects of <<
undefined behavior. guess want "translation" of gcc common language.
if behavior undefined c standard, compiler implementors can take "latitude" suits them if such case occurs. in particular, don't have implement diagnostic or detection of case, , may pretend never happens. responsability of programmer write program such behavior defined.
in case of left shift, means compiler not have check overflow , can pretend loop like
for (int = 1; > 0; <<= a) { .... change in complicated way ... }
would never terminate.
the sentence citing indicates don't such thing, yet, future versions of gcc might so.
Comments
Post a Comment