Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter
to the top
close form

Remplissez le formulaire ci‑dessous en 2 étapes simples :

Vos coordonnées :

Étape 1
Félicitations ! Voici votre code promo !

Type de licence souhaité :

Étape 2
Team license
Enterprise licence
** En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité
close form
Demandez des tarifs
Nouvelle licence
Renouvellement de licence
--Sélectionnez la devise--
USD
EUR
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
La licence PVS‑Studio gratuit pour les spécialistes Microsoft MVP
close form
Pour obtenir la licence de votre projet open source, s’il vous plait rempliez ce formulaire
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
I am interested to try it on the platforms:
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
check circle
Votre message a été envoyé.

Nous vous répondrons à


Si vous n'avez toujours pas reçu de réponse, vérifiez votre dossier
Spam/Junk et cliquez sur le bouton "Not Spam".
De cette façon, vous ne manquerez la réponse de notre équipe.

>
>
>
V2614. MISRA. External identifiers shou…
menu mobile close menu
Analyzer diagnostics
General Analysis (C++)
General Analysis (C#)
General Analysis (Java)
Micro-Optimizations (C++)
Diagnosis of 64-bit errors (Viva64, C++)
Customer specific requests (C++)
MISRA errors
AUTOSAR errors
OWASP errors (C#)
Problems related to code analyzer
Additional information
toggle menu Contents

V2614. MISRA. External identifiers should be distinct.

04 Oct 2021

This diagnostic rule is based on the MISRA (Motor Industry Software Reliability Association) guidelines for software development.

This rule applies only to C. Identifiers with external linkage should be easily distinguished within the limitations imposed by the standard used.

The limitations are as follows:

  • before standard C99 - 6 significant characters, case-insensitive;
  • starting with standard C99 - 31 significant characters, case-sensitive.

Example 1:

//         123456789012345678901234567890123
extern int shrtfn(void);                            // OK
extern int longfuncname(void);                      // Error in C90,
                                                    // but OK in C99
extern int longlonglonglonglongfunctionname1(void); // Error in both

Long identifiers make it difficult to read code - and it's easy to confuse them with automatically generated identifiers. Also, when two identifiers differ only in characters that are not significant, this causes undefined behavior.

Some implementations of compilers and linkers can have their own limitations. To find out what these limitations are, refer to these tools' documentation.

Example 2:

//         123456789012345678901234567890123
extern int longFuncName1(int);
extern int longFuncName2(int);

extern int AAA;
extern int aaa;

void foo(void)
{
  longFuncName2(AAA);
}

This code contains several errors at once (we'll examine this code based on the C90 standard):

  • Identifiers 'longFuncName1' and 'longFuncName2' will be truncated down to the first 6 characters ('longFu'). So the linker will regard them as identical.
  • According to the C90 standard, identifiers are not always case-sensitive - so the linker can interpret identifiers 'AAA' and 'aaa' as identical as well.
  • The 'foo' function calls the 'longFuncName2' function and passes the 'AAA' variable value as its parameter. This call leads to undefined behavior because each of these two identifiers cannot be interpreted as distinct.

This diagnostic is classified as:

  • MISRA-C-5.1