JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++


LANG.ID.AMBIG : Typographically Ambiguous Identifiers

Summary

Two or more non-identical identifiers are both in scope and may be confused for one another because their only differences involve characters that are typographically similar:

Typographically Ambiguous Characters Description
0 / O numeric zero / capital o
1 / I / l numeric one / capital i / lower case L
2 / Z numeric two / capital z
5 / S numeric five / capital s
8 / B numeric eight / capital b
h / n lower case H / lower case N
rn / m lower case RN / lower case M
a..z / A..Z lower case character / upper case equivalent
strA_strB / strAstrB a string containing an underscore / the equivalent string without the underscore

Properties

Class Name Typographically Ambiguous Identifiers
Significance style
Mnemonic LANG.ID.AMBIG
Categories
MisraC2025 MisraC2025:D.4.5 Identifiers in the same name space with overlapping visibility should be typographically unambiguous
MisraC2023 MisraC2023:D.4.5 Identifiers in the same name space with overlapping visibility should be typographically unambiguous
Misra2012 Misra2012:D.4.5 Identifiers in the same name space with overlapping visibility should be typographically unambiguous
AUTOSARC++14 AUTOSARC++14:M2-10-1 Different identifiers shall be typographically unambiguous.
MisraC++2008 MisraC++2008:2-10-1 Different identifiers shall be typographically unambiguous.
CWE CWE:1007 Insufficient Visual Distinction of Homoglyphs Presented to User
CERT-C CERT-C:DCL02-C Use visually distinct identifiers
JSF++ JSF++:48 Identifiers will not be typographically ambiguous.
Availability Available for C and C++.
Enabling Checks for this warning class are disabled by default, and require the unnormalized C ASTs for the project. To enable them, add the following WARNING_FILTER rule and RETAIN_UNNORMALIZED_C_AST specification to the project configuration file.
RETAIN_UNNORMALIZED_C_AST = Yes
INCREMENTAL_BUILD = No
WARNING_FILTER += allow class="Typographically Ambiguous Identifiers"
Note that retaining the unnormalized ASTs will increase the disk space used to store the project representation, and may make the analysis take longer.

Incrementality Note: This warning class is not available for incremental analyses, even if the class is explicitly enabled.

Example

int a0;
int b1;
int c2;
int d5;
int e8;
int fh;               /* 'Typographically Ambiguous Identifiers' warning issued here */
int myint;
double mydouble;
int ma;
        
void ID_AMBIG(void){
    int aO;           /* 'Typographically Ambiguous Identifiers' warning issued here */
    int bI;           /* 'Typographically Ambiguous Identifiers' warning issued here */
    int cZ;           /* 'Typographically Ambiguous Identifiers' warning issued here */
    float dS;         /* 'Typographically Ambiguous Identifiers' warning issued here */
    int * eB;         /* 'Typographically Ambiguous Identifiers' warning issued here */
    int MyInt;        /* 'Typographically Ambiguous Identifiers' warning issued here */
    double my_double; /* 'Typographically Ambiguous Identifiers' warning issued here */
    int rna;          /* 'Typographically Ambiguous Identifiers' warning issued here */

    int g1;                                   /* locals for fn() are not in scope */
    /* ... */
}

void fn(void){ 
    int bl;           /* 'Typographically Ambiguous Identifiers' warning issued here */
    int gl;                                  /* locals for ID_AMBIG() are not in scope */

    /* ... */
}

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.

 

To report problems with this documentation, please visit https://support.codesecure.com/.