![]() |
![]() |
2948 | ![]() |
||||
![]() | |||||||
| Conversion to signed | |||||||
Dataflow analysis has identified a code construct which is suspicious. The code may be entirely safe but further investigation is advisable. The value of an expression is being cast to a signed integer type. Examination of the immediate context suggests that the value could sometimes only be representable in this particular type in two's-complement representation. In practice, two's complement representation is almost universal in modern computers, but other binary representations do exist. Message 2948 will be generated when
/*PRQA S 282,1278,2017,2983,2986,3120,3199,3203,3204,3227,3408,3602 ++*/
/***************************************************/
/* OPTIONS: -s int=16 */
/***************************************************/
void foo(int n)
{
signed int sir;
signed long slr = -32768L;
int i;
for (i = 0; i < n; ++i)
{
++slr;
}
sir = (signed int)slr; /* 2948 */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |