Gilboa Davara <[EMAIL PROTECTED]> writes: > CPP/GCC/CC all define _WIN32 by default under all the environment I ever > worked on. (which is pretty extensive.)
Really? Right now I am in an environment where several different version of cpp and gcc don't define that. It seems to me that the range of environments where gcc defines _WIN32 is pretty narrow. To complement that, I have no idea what you mean by CPP or CC. > By design, compilers running under Windows (be that Watcom, Borland or > MCVC) must define _WINTVER, _WIN32 and M_IX86/M_ALPA/etc in-order to > include the Winxxx.h files. (which are required to access any OS > functions) That's fine, this is exactly one platform that we have covered in the passage above. > So yes, these are compiler defined macros that can be relayed upon. Yes, indeed. However, I know of no rule that says that, e.g., unix must be defined for any of the unices or for Linux, as the snippet of your earlier mail that follows below seems to imply. On my RH7.3 gcc does define unix, __unix, __unix__, linux, __linux, and __linux__. However, it is enough to use the -ansi option to make unix and linux disappear. There you go. None of the standard glibc or glibc-kernel headers (meaning linux-specific headers exposed to applications programmers) uses unix, __unix, or __unix__ (some applications do, but it's their business). This tells me that gcc only uses those internally, and not to access any library or system facilities. This means that there may be compilers that will not define these macros and still work just fine. Gilboa Davara <[EMAIL PROTECTED]> writes: > Better yet: > > #ifdef unix > > // UNIX/Linux/*BSD. > > #endif > > #ifdef _WIN32 > > // Window stuff > > #endif > > Both symbols are auto defined by the compiler. -- Oleg Goldshmidt | [EMAIL PROTECTED] ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
