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 |
ポインタ型 fl* からポインタ型 T*、若しくはポインタ型 T* からポインタ型 fl*へのキャスト若しくは型強制が行われています。尚:
| クラス名 | Float Pointer Conversion | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 日本語クラス名 | 浮動小数点ポインタと異なる型のポインタとの型変換 | ||||||||||||||||||||||||
| クラス分類 | スタイル (style) | ||||||||||||||||||||||||
| ニーモニック | LANG.CAST.PC.FLOAT | ||||||||||||||||||||||||
| カテゴリー |
|
||||||||||||||||||||||||
| 対応言語 | C および C++ で利用可能です。 |
||||||||||||||||||||||||
| 有効/無効設定 | このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST
が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと
RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes WARNING_FILTER += allow class="Float Pointer Conversion" |
double * to_floatptr(float *fptr, void* vptr, int *intptr, long int i ){
float *localfptr;
double d = (double) i; /* no pointer conversion */
localfptr = (float *) &d; /* 'Float Pointer Conversion' warning issued here (cast from double* to float*) */
switch (i) {
case 1:
fptr = intptr; /* 'Float Pointer Conversion' warning issued here (coercion from int* to float*)
* ('Incompatible Assignment Operands' warning also issued)
*/
break;
case 2:
fptr = (float*) intptr; /* 'Float Pointer Conversion' warning issued here (cast from int* to float*) */
break;
case 3:
fptr = i; /* ok: coercion from non-pointer to float*
* ('Incompatible Assignment Operands' warning issued)
*/
break;
case 4:
*fptr = *localfptr; /* no pointer conversion */
break;
default:
fptr = vptr; /* ok: coercion from void* to float* */
break;
}
return fptr; /* 'Float Pointer Conversion' warning issued here (coercion from float* to double*)
* ('Bad Return Value Type' warning also issued)
*/
}
int from_floatptr(float *fptr, double d, int i){
int localint = (int)fptr; /* ok: cast from float* to non-pointer */
int *iptr;
void *vptr = fptr; /* ok: coercion from float* to void* */
switch (i){
case 1:
iptr = fptr; /* 'Float Pointer Conversion' warning issued here (coercion from float* to int*)
* ('Incompatible Assignment Operands' warning also issued)
*/
break;
case 2:
iptr = (int *)&d; /* 'Float Pointer Conversion' warning issued here (cast from double* to int*) */
break;
default:
iptr = vptr; /* no float pointer involved */
break;
}
return *iptr + localint; /* no float pointer involved */
}
設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。
To report problems with this documentation, please visit https://support.codesecure.com/.