このエラーは、最適化を実行する「フリー」(リリース) の WinDDK nmake コンパイラでビルドした場合にのみ発生します。「チェック済み」ビルドまたは VS でのコンパイルでは、これを再現できません。
私のコードで何が起こっているかの疑似コードは次のとおりです。
main()
{
//variable init and other code
fprintf(log, "pre nullValue: %lu\n", NULL); //printf added for debugging
otherFunc();
funcWithError(str1, str2, NULL);
fprintf(log, "post nullValue: %lu\n", NULL);
fprintf(log, "post2 nullValue: %lu, %lu, %lu\n", NULL, 0, NULL);
}
BOOL otherFunc()
{
//variable init and other code
callToDll();
//...doing stuff
libusb_usb_open(var1); //If I remove this line there is no problem!!
//...doing more stuff
}
BOOL funcWithError(char* s1, char* s2, FUNC_PTR fp)
{
fprintf(log, "inFunc nullValue: %lu, %lu\n", NULL, fp);
if(fp != NULL)
return FALSE; //This line is being executed erroneously!!
}
ログに出力:
pre nullValue: 0
inFunc nullValue: 0, 251208
post nullValue: 251208
post2 nullValue: 251208, 251208, 251208
注: 再発生番号 (251208) は、プログラムが実行されるたびに異なる番号です
その1行を変更するだけで修正/原因になります。libusb usb_open呼び出しです 。
- 最終的に私の質問は、問題を解決する方法を見つけることです (私はその電話を避けることはできません)
- しかし、スタック/メモリ管理レベルでは、ゼロ以外の NULL を持ち、リテラル値 '0' をゼロ以外として出力することはどのように可能でしょうか?
他に役立つ情報を教えてください...