一、 介紹預定義宏 "_MSC_VER" 一.1 _MSC_VER是微軟C/C++編譯器——cl.exe編譯代碼時預定義的一個宏。需要針對cl編寫代碼時, 可以使用該宏進行條件編譯。 一.2 _MSC_VER的值表示cl的版本。需要針對cl特定版本編寫代碼時, 也可以使用該宏進行條件編譯。對應關系點此鏈接查看。 一.3 _MSC_VER的類型是"int"該宏被擴展后,得到的是整數字面值。可以通過僅預處理, 查看宏擴展后的文本。見:《查看源文件預處理結果》。同時下面的示例也能體現出這一點。
Evaluates to the major and minor number components of the compiler's version number. The major number is the first component of the period-delimited version number and the minor number is the second component.
For example, if the version number of the VC++ compiler is 15.00.20706.01, the _MSC_VER macro evaluates to 1500.
本作品采用知識共享署名-非商業性使用-相同方式共享 2.5 中國大陸許可協議進行許可。 轉載請注明 :文章作者 - OwnWaterloo發表時間 - 2009年04月15日原文鏈接 - http://www.shnenglu.com/ownwaterloo/archive/2009/04/15/predefined_macro__MSC_VER.html