[英]Seeming evaluation of preprocessor code inside a #if false block
我正在通過MonoDevelop 4.0.1(Unity的當前版本)在C#中工作,並且遇到了一種看似奇怪的語言。
這是我的整個.cs文件:
#if false
#define foo
#endif
class myClass {
int member;
}
#if false
#error this error does not trigger
#undef foo
// "cannot define or undefine preprocessor symbols after first token in file
#endif
我了解有關在聲明令牌后不#undef
預處理程序符號的規則,但是在這種情況下,我不是 #undef
ing,因為#undef
在#if false
內部。
這個示例並非完全是人為設計的,它是嘗試通過此處描述的方法使單個源文件在C#和C ++中進行編譯。
Visual Studio不會抱怨相同的代碼。 我認為您已經在Mono中發現了一個錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.