小编Ach*_*hla的帖子

为什么预处理器用Borland C ++标识枚举值,而不能用Visual C ++标识枚举值?

我正在尝试将项目从迁移Borland C++Visual C++

我注意到如本例所述在处理枚举方面存在差异

档案:Test_enum.cpp

    #ifdef  _MSC_VER
        #include <iostream>
    #else
        #include <iostream.h>
    #endif
    #include <conio.h>

    using namespace std;

    enum {

        ENUM_0 =0,
        ENUM_1,
        ENUM_2,
        ENUM_3
        } ;

     int main(int argc, char* argv[])
    {
        #ifdef  _MSC_VER
        cout << "Microsoft Visual compiler detected!" << endl;
        #elif defined(__BORLANDC__)
        cout << "Borland compiler detected!" << endl;
        #elif
        cout << "Other compiler detected!" << endl;
        #endif
        #if ENUM_1 > 0
        cout << "ENUM_1 is well defined at preprocessing time" << endl;
        #else …
Run Code Online (Sandbox Code Playgroud)

c++ enums visual-c++ c-preprocessor borland-c++

0
推荐指数
1
解决办法
212
查看次数

标签 统计

borland-c++ ×1

c++ ×1

c-preprocessor ×1

enums ×1

visual-c++ ×1