编译器条件编译宏

来源:互联网 发布:神龙契约披风数据 编辑:程序博客网 时间:2024/06/06 08:55

There's no inter-compiler standard, but each compiler tends to be quite consistent. You can build a header for yourself that's something like this:

#if MSVC#ifdef _M_X86#define ARCH_X86#endif#endif#if GCC#ifdef __i386__#define ARCH_X86#endif#endif

There's not much point to a comprehensive list, because there are thousands of compilers but only 3-4 in widespread use (Microsoft C++, GCC, Intel CC, maybe TenDRA?). Just decide which compilers your application will support, list their #defines, and update your header as needed.

0 0
原创粉丝点击