![]() |
![]() |
1478 | ![]() |
||||
![]() | |||||||
| Enumerations | REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers | ||||||
The value of an object of enum type is being implicitly compared against 0 in a controlling expression. This is suspicious, since the enumeration list of this enum type does not include a zero value. Note that 0 can always be represented in an object of enum type, regardless of the enumeration list specified, thus the result of this operation is not always 'true'. For example:
/*PRQA S 1-9999 ++*/
/*PRQA S 1478, 3344 --*/
enum EC { RED = 1, BLUE = 2, GREEN = 3 };
extern void foo(enum EC ex)
{
if (ex) { } /* Message 1478 + 3344 */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |