symbol.c:関数'symbol_FPrint'内:
symbol.c:1209: warning: format '%ld' expects type 'long int', but argument 3 has type 'SYMBOL'
symbol.c: In function 'symbol_FPrintOtter':
symbol.c:1236: warning: format '%ld' expects type 'long int', but argument 3 has type 'SYMBOL'
symbol.c:1239: warning: format '%ld' expects type 'long int', but argument 3 has type 'SYMBOL'
symbol.c:1243: warning: format '%ld' expects type 'long int', but argument 3 has type 'SYMBOL'
symbol.c:1266: warning: format '%ld' expects type 'long int', but argument 3 has type 'SYMBOL'
symbol.cで
1198 #ifdef CHECK
1199 else {
1200 misc_StartErrorReport();
1201 misc_ErrorReport("\n In symbol_FPrint: Cannot print symbol.\n");
1202 misc_FinishErrorReport();
1203 }
1204 #endif
1205 }
1206 else if (symbol_SignatureExists())
1207 fputs(symbol_Name(Symbol), File);
1208 else
1209 fprintf(File, "%ld", Symbol);
1210 }
そして、SYMBOLは次のように定義されます。
typedef size_t SYMBOL
'%ld'を'%zu'に置き換えると、次の警告が表示されます。
symbol.c: In function 'symbol_FPrint':
symbol.c:1209: warning: ISO C90 does not support the 'z' printf length modifier
注:ここから2010年3月26日に編集され、上記の問題と類似しているため、以下の問題が追加されました。
私は次のステートメントを持っています:
printf("\n\t %4d:%4d:%4d:%4d:%4d:%s:%d", Index, S->info, S->weight,
Precedence[Index],S->props,S->name, S->length);
64ビットアーキテクチャでのコンパイル中に発生する警告は次のとおりです。
format ‘%4d’ expects type ‘int’, but argument 5 has type ‘size_t’
パラメータの定義は次のとおりです。
NAT props;
typedef unsigned int NAT;
32ビットおよび64ビットアーキテクチャで警告なしにコンパイルできるように、これを取り除くにはどうすればよいですか?
その解決策は何でしょうか?