C and C++


LANG.STRUCT.DECL.IMPT : Implicit Type

要旨

A type is not explicitly specified in one of the following contexts.

When type is not explicitly specified in these cases, it is implicitly int. This may not be what the writer intended, or what a reader assumes.

プロパティ

クラス名 Implicit Type
日本語クラス名 Implicit Type
クラス分類 スタイル (style)
ニーモニック LANG.STRUCT.DECL.IMPT
カテゴリー
MisraC2023 MisraC2023:8.1 Types shall be explicitly specified
Misra2012 Misra2012:8.1 Types shall be explicitly specified
Misra2004 Misra2004:8.2 Whenever an object or function is declared or defined, its type shall be explicitly stated
CERT-C CERT-C:DCL07-C Include the appropriate type information in function declarators
対応言語 C のみ利用可能です。 C++ は利用できません。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Implicit Type"

f1();              /* 'Implicit Type' warning issued here
                    * - return type implicitly int
                    */
int f2();                           /* ok: explicit return type */

g1(){              /* 'Implicit Type' warning issued here
                    * - return type implicitly int
                    */
    return 42;
}

int g2(){                           /* ok: explicit return type */
    return 42;
}

int h1(const x);   /* 'Implicit Type' warning issued here
                    * - parameter type implicitly const int
                    */
int h2(const int x);                /* ok: explicit parameter type */

a_global1 = 42;    /* 'Implicit Type' warning issued here
                    * - variable type implicitly int
                    */
int a_global2 = 42;                 /* ok: explicit variable type */

extern an_extern1; /* 'Implicit Type' warning issued here
                    * - variable type implicitly int
                    */
extern int an_extern2;              /* ok: explicit variable type */

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

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