MISRA Discussion Forums

Full Version: Rule 5.1: typographical error?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The amplification for this rule states:

Quote:In C99 the minimum requirement is that the first 31 characters of external identifiers are significant, with each universal character or corresponding extended source character occupying between 6 and 10 characters.

I think this is an error, and the statement should end as the parallel statement for Rule 5.2:

Quote:In C99 the minimum requirement is that the first 31 characters of external identifiers are significant, with each universal character or corresponding extended source character counting as a single character.

Is this correct?

-Stephen H. Westin
GrammaTech, Inc.
The difference in the wording is intentional and is based on the wording in the translation limits section 5.2.4.1 of the C99 standard.
Quote: - 63 significant initial characters in an internal identifier or a macro name (each universal character name or extended source character is considered a single character)

- 31 significant initial characters in an external identifier (each universal character name specifying a short identifier of 0000FFFF or less is considered 6 characters, each universal character name specifying a short characters identifier of 00010000 or more is considered 10 characters, and each extended source character is considered the same number of characters as the corresponding universal character name, if any)
An internal identifier is never visible outside the translation unit in which it is declared. It is therefore not necessary to worry about external representation issues and it is possible to count each universal character name as one character. In contrast, information on externally visible identifiers needs to be compared against identifiers declared in other translation units. The values of 6 and 10 were chosen so that the encodings \u1234 and \U12345678 could be used.