编译器 不同的宏

来源:互联网 发布:顺时seo 海军帽 编辑:程序博客网 时间:2024/05/18 05:02
#include<iostream>using namespace std;int main(){#ifdef __cplusplus        cout << "__cplusplus:" << __cplusplus << endl;#endif#ifdef _WIN32        cout << "_WIN32:"<< _WIN32 <<endl;#endif#ifdef __APPLE__        cout << "__APPLE:" << __APPLE__ << endl;#endif#ifdef __linux__        cout << "__linux__:" << __linux__ << endl;#endif#ifdef _MSC_VER        cout << "_MSC_VER:" << _MSC_VER << endl;#endif#ifdef __INTEL_COMPLIER        cout << "__INTEL_COMPLIER:" << __INTEL_COMPILER << endl;#endif#ifdef __clang__        cout << "__clang__:" << __clang__ << endl;#endif#ifdef __GNUC__        cout << "__GNUC__:" << __GNUC__ << endl;#endif#ifdef __GNUC_MINOR__        cout << "__GNUC_MINOR__:" << __GNUC_MINOR__ << endl;#endif#ifdef __GNUC_PATCHLEVEL__        cout << "__GNUC_PATCHLEVEL__:" << __GNUC_PATCHLEVEL__ << endl;#endif        return 0;}
$ g++ demo205.cppAdministrator@xiuye-PC /cygdrive/d/programming/c++$ ./a__cplusplus:199711__GNUC__:5__GNUC_MINOR__:4__GNUC_PATCHLEVEL__:0

Administrator@xiuye-PC /cygdrive/d/programming/c++$ clang++ demo205.cppAdministrator@xiuye-PC /cygdrive/d/programming/c++$ ./a__cplusplus:199711__clang__:1__GNUC__:4__GNUC_MINOR__:2__GNUC_PATCHLEVEL__:1

$ cl demo205.cpp$ ./demo205__cplusplus:199711_WIN32:1_MSC_VER:1800


0 0
原创粉丝点击