TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
ASML C Coding Standard
Search

Rule:  6.5.7.bChecked automatically with code checker

Synopsis:The right operand of a left shift operator for a signed type as left operand shall not be so large that the resulting value cannot be represented.
Language:C
Severity Level:4
Category:Expressions


Description:

Justification

Such shifts lead to undefined behavior. In general, only the constant case is statically detectable, for example:

Example

int a = 3;
int b;

b = (a << 46); /* WRONG: int may be 32 bits */