C and C++


LANG.ID.AMBIG : 紛らわしい識別子

要旨

字体が類似しているため混乱する可能性のある異なる識別子が同一スコープ内に存在します。

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

プロパティ

クラス名 Typographically Ambiguous Identifiers
日本語クラス名 紛らわしい識別子
クラス分類 スタイル (style)
ニーモニック LANG.ID.AMBIG
カテゴリー
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.
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes
INCREMENTAL_BUILD = No
WARNING_FILTER += allow class="Typographically Ambiguous Identifiers"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

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 */

    /* ... */
}

関連のある設定ファイルパラメータ

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。