/**/
/* 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
}
/**/ /* 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
Press any key to continue