Rule #5.1 clarification

6.5 Identifiers

Moderators: misra-c, david ward

Post Reply
gs
Posts: 87
Joined: Thu Nov 18, 2004 1:39 am

Rule #5.1 clarification

Post by gs » Mon Dec 10, 2012 3:49 pm

Hi,
The conversation at http://www.misra.org.uk/forum/viewtopic.php?f=61&t=508 states identifiers longer than 31 characters are permitted. However, the exemplar suite suggest such identifiers are, per se, prohibited. Which is correct?

misra-c
Posts: 572
Joined: Thu Jan 05, 2006 1:11 pm

Re: Rule #5.1 clarification

Post by misra-c » Thu Dec 20, 2012 4:28 pm

Rule 5.1, as clarified by TC1, requires identifiers to be distinct in the first 31 characters across all namespaces. Identifiers that are longer than 31 characters are indeed permitted provided that they are distinct in the first 31 characters.

The examples of non-compliance in the exemplar suite are intended to support this view. For example, lines 43 and 44 of mc2_0501_1.h read:

Code: Select all

extern int32_t name_68_xvxv_xxxxxxxxxxxxxxxx31a;        /* Not Compliant */
extern int32_t name_68_xvxv_xxxxxxxxxxxxxxxx31b;        /* Not Compliant */
These identifiers are non-compliant because they do not differ from each other in the first 31 characters. If there are any examples of identifiers that are non-compliant purely because of their length, please report their location so that we can investigate further.

Note that the minimum requirement on a conforming implementation with regard to external identifiers is to support up to 6 significant characters without regard to their case. In practice most implementations support a higher number of characters and distinguish between case of external identifiers but this should be confirmed if it is being relied on.
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “6.5 Identifiers”