一、 介紹預(yù)定義宏 "_MSC_VER" 一.1 _MSC_VER是微軟C/C++編譯器——cl.exe編譯代碼時(shí)預(yù)定義的一個(gè)宏。需要針對(duì)cl編寫(xiě)代碼時(shí), 可以使用該宏進(jìn)行條件編譯。 一.2 _MSC_VER的值表示cl的版本。需要針對(duì)cl特定版本編寫(xiě)代碼時(shí), 也可以使用該宏進(jìn)行條件編譯。對(duì)應(yīng)關(guān)系點(diǎn)此鏈接查看。 一.3 _MSC_VER的類型是"int"該宏被擴(kuò)展后,得到的是整數(shù)字面值。可以通過(guò)僅預(yù)處理, 查看宏擴(kuò)展后的文本。見(jiàn):《查看源文件預(yù)處理結(jié)果》。同時(shí)下面的示例也能體現(xiàn)出這一點(diǎn)。
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.
本作品采用知識(shí)共享署名-非商業(yè)性使用-相同方式共享 2.5 中國(guó)大陸許可協(xié)議進(jìn)行許可。 轉(zhuǎn)載請(qǐng)注明 :文章作者 - OwnWaterloo發(fā)表時(shí)間 - 2009年04月15日原文鏈接 - http://www.shnenglu.com/ownwaterloo/archive/2009/04/15/predefined_macro__MSC_VER.html