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.STRUCT.FUNCPTR.CONVERT : 関数ポインタのキャスト変換

要旨

異なった型で関数ポインタがキャストされています。

プロパティ

クラス名 Function Pointer Conversion
日本語クラス名 関数ポインタのキャスト変換
クラス分類 スタイル (style)
ニーモニック LANG.STRUCT.FUNCPTR.CONVERT
カテゴリー
MisraC2025 MisraC2025:11.1 Conversions shall not be performed between a pointer to a function and any other type
MisraC2023 MisraC2023:11.1 Conversions shall not be performed between a pointer to a function and any other type
Misra2012 Misra2012:11.1 Conversions shall not be performed between a pointer to a function and any other type
Misra2004 Misra2004:11.1 Conversions shall not be performed between a pointer to a function and any type other than an integral type
  Misra2004:11.2 Conversions shall not be performed between a pointer to object and any type other than an integral type, another pointer to object type or a pointer to void
  Misra2004:11.3 A cast should not be performed between a pointer type and an integral type
AUTOSARC++14 AUTOSARC++14:M5-2-6 A cast shall not convert a pointer to a function to any other pointer type, including a pointer to function type.
  AUTOSARC++14:M8-4-4 A function identifier shall either be used to call the function or it shall be preceded by &.
MisraC++2008 MisraC++2008:5-2-6 A cast shall not convert a pointer to a function to any other pointer type, including a pointer to function type.
  MisraC++2008:8-4-4 A function identifier shall either be used to call the function or it shall be preceded by &.
CWE CWE:710 Improper Adherence to Coding Standards
JPL JPL:30 Do not cast function pointers into other types.
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Function Pointer Conversion"

unsigned char ucatch(int);

char (*f)(int) = ucatch; /* 'Function Pointer Conversion' warning issued here
                          * ('Bad Initializer Type' warning also issued)
                          */

See also

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

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

 

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