[previous] 1323 [next] The sizeof operator has been applied to an enum constant.
Enumerations REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers

The sizeof operator has been applied to an enum constant.

This operation makes little sense in C, because, in C the type of an enum constant is always int. However, in C++ the type of an enum constant can be a different integer type.

For example:


/*PRQA S 702,2017,2211,2213,3199,3203,3205,3408,3470,3602 ++*/

enum ET { A, B, C };

void f(void)
{
    unsigned long ula;

    ula = sizeof(B);                            /* Message 1323 */
}

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents