C源码:可以检测10 种C语言编译环境的程序

/* CCOS.C --- Test the C language compiler and OS by predefined symbols */  
/* M.L.Y  2000.12 */
#include 
< stdio.h >  
void  main() {
#if defined(MSDOS) & defined(_MSC_VER)           /* Microsoft C */ 
    printf(
"It is MS-DOS, Microsoft C. "); 
#endif 
#if defined(__MSDOS__) &                         /* Turbo C/BC */ 
    (defined(__TURBOC__) 
| defined(__BORLANDC__))
    printf(
"It is MS-DOS, Borland Turbo C / Borland C++. "); 
#endif
#if __hppa & __hp3000s900 & __mpexl              /* HP 3000 */
    printf(
"It is HP 3000, MPE/iX, HP C/iX. "); 
#endif
#if vax & VAX & vms & VMS                        /* DEC VAX */ 
    
& vaxc & VAXC & vax11c & VAX11C 
    
& defined(vms_version) & defined(VMS_VERSION)
    printf(
"It is DEC VAX, VMS, VAX 11 C. "); 
#endif 
#if __vms & __VMS                                /* DEC Alpha */ 
    
& __vaxc & __VAXC & __vax11c & __VAX11C 
    
& __DECC & defined(__vms_version) & defined(__VMS_VERSION) 
    
& __Alpha_AXP & __Alpha & __ALPHA & __32BITS
    printf(
"It is DEC Alpha AXP, Open VMS, DEC C. "); 
#endif
#if __OS400__                                    /* AS/400 */
    printf(
"It is AS/400, OS/400. "); 
#endif
#if mips & __mips & host_mips & __host_mips      /* Tandem */ 
    
& unix & __unix & __nonstopux 
    
& SYSTYPE_SVR4 & _SYSTYPE_SVR4 & LANGUAGE_C & _LANGUAGE_C
    printf(
"It is Tandem(puma S4000 mips,...), NonStop-UX/V(Rel4.2MP,...). "); 
#endif
#if (hp9000s200 | hp9000s300 | __hp9000s300      /* HP 9000 */ 
    
| hp9000s500 | hp9000s800 | __hp9000s800 | hp9000ipc) 
    
& (hppa | __hppa) & (_PA_RISC1_0 | _PA_RISC1_1) 
    
& (unix | __unix) & (hpux | __hpux)
    printf(
"It is HP 9000, HP-UX. ");
#endif
#if i386 & M_I386 & unix & __unix & M_UNIX       /* SCO UNIX */ 
    
& (_SCO_COFF | _SCO_ELF)
    printf(
"It is SCO UNIX(SCO OpenServer) on Intel 386 or above. "); 
#endif
#if i386 & _I386 & unix & __HIGHC__ & _ATT4      /* NCR UNIX */
    printf(
"It is NCR MP-RAS SVR4 UNIX System on Intel 386 or above. "); 
#endif
}

 程序的运行结果:

It is MS-DOS ,  Microsoft C .
Press any key to continue
from: http://fanqiang.chinaunix.net/program/code/2001-08-22/2185.shtml
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值