我正在尝试将项目从迁移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)