常量由操作系统或编译平台定义,在编译时用于确定编译平台。
以下代码在VC6及VC2008下测试通过。
测试时间:2011-3-7
// 常量由操作系统或编译平台定义,在编译时用于确定编译平台
#include <stdio.h>
int main()
{
#ifdef __OpenBSD__
printf("OpenBSD/n");
#elif __FreeBSD__
printf("FreeBSD/n");
#elif __NetBSD__
printf("NetBSD/n");
#elif __Linux
printf("Linux/n");
#elif __Apple MacOS X__
printf("Apple MacOS X/n");
#elif SOLARIS
printf("SOLARIS/n");
#elif WIN32
printf("Windows/n");
#else
printf("?/n");
#endif
return 0;
}