Moderators: misra-c, david ward
- Posts: 8
- Joined: Wed May 28, 2014 6:53 pm
- Company: GrammaTech Inc.
The amplification for this rule states:
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:
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
- Posts: 571
- Joined: Thu Jan 05, 2006 1:11 pm
The difference in the wording is intentional and is based on the wording in the translation limits section 220.127.116.11 of the C99 standard.
- 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.
Posted by and on behalf of
the MISRA C Working Group