In addition to being difficult to use, too-long variable names can limit code portability. The ISO standard requires that variable, type, function
and label names be no more than 31 characters long.
Note that 31 characters is an upper bound, rather than a length recommendation. Shorter names are better, as long as they’re still
Noncompliant Code Example
int this_is_a_very_long_identifier_that_definitely_should_be_renamed = 0;
int reasonable_identifier = 0;
- MISRA C:2004, 5.1 - Identifiers (internal and external) shall not rely on the significance of more than 31 character.
- CERT, DCL23-C. - Guarantee that mutually visible identifiers are unique