![]() |
![]() |
0580 | ![]() |
||||
![]() | |||||||
| Constraint violations | REFERENCE - ISO:C90-6.4 Constant Expressions - Constraints | ||||||
This is a constraint error A constant is being used which is too large to be represented. If it is an integer constant, it must be representable within the largest available unsigned type (i.e. unsigned long or unsigned long long depending on whether the option -ex LONGLONG is enabled). If it is a floating constant, it must be representable within the type of the constant (i.e. float, double or long double, depending on whether the constant has an appropriate suffix). QA·C assumes that the maximum values representable in types float, double and long double are the values specifed in IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985) which most implementations adhere to:
FLT_MAX 3.40282347E+38F DBL_MAX 1.7976931348623157E+308 LDBL_MAX 1.7976931348623157E+308LNotice that the type of a constant is NOT determined by the type of any object to which the constant happens to be assigned. For example:
/*PRQA S 1264,1265,1278,3120,3121,3198,3210,3211,3408,3447 ++*/
/**************************************/
/* OPTIONS: -ex LONGLONG */
/**************************************/
extern unsigned long long ux;
extern long double ld;
void foo(void)
{
ux = 18446744073709551615ULL; /* */
ux = 18446744073709551616ULL; /* Message 0580 */
ld = 3.4028234E38F; /* */
ld = 3.4028235E38F; /* Message 0580 */
ld = 1.797693134E308; /* */
ld = 1.797693135E308; /* Message 0580 */
ld = 1.797693134E308L; /* */
ld = 1.797693135E308L; /* Message 0580 */
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |