![]() |
![]() |
2940 | ![]() |
||||
![]() | |||||||
| Conversion to signed | |||||||
A negative value is being implicitly converted to a signed type and the value is such that it can only be represented in a signed type of this size in a two's-complement form. In practice, two's complement representation is almost universal in modern computers, but other binary representations do exist. Message 2940 will be generated when:
/*PRQA S 274,280,1278,2017,2982,2984,3120,3198,3210,3408,3447,3602,3606 ++*/
/***************************************************/
/* OPTIONS: -s int=16 */
/***************************************************/
extern signed char sca;
extern signed short ssa;
extern signed int sia;
extern void foo(void)
{
sca = -127;
sca = -128; /* 2940 */
sca = -129; /* 2850 */
ssa = -32767;
ssa = -32767 - 1; /* 2940 */
ssa = -32769L; /* 2850 */
sia = -32767;
sia = -32767 - 1; /* 2940 */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |