CPP/GCC/CC all define _WIN32 by default under all the environment I ever
worked on. (which is pretty extensive.)

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)

So yes, these are compiler defined macros that can be relayed upon.

Gilboa


On Thu, 2003-07-03 at 21:08, Oleg Goldshmidt wrote:
> 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.
> 
> What is "the compiler"? How can you be sure that 6 months from now
> someone in New Zealand will be using "the compiler"?
> 
> There is nothing I know of that will guarantee existence of "unix" or
> "_WIN32". Even worse, what about the cases where Solaris, AIX, HPUX,
> Linux, DG/UX, and assorted BSDs all work differently, what good is
> "unix" then? If a compiler defines something like that, it is most
> likely for its own internal use, and to comply with the system
> facilities, *not* to be exported into client code.
> 
> To the OP:
> 
> Create your own compilation environment, call your CPP macros whatever
> you want, in your Makefile or configuration files define the proper
> flags depending on the output of things like uname -s etc. In short,
> do whatever is needed but do not rely on things that *a* compiler
> defines automatically.
> 
> Finally, if you suspect that something or somebody is #undefing or
> #defining your macros without you knowing it, try to make the compiler
> #as verbose as possible - maybe there will be a clue there. Often you
> #will see what it silently #defines or #undefs on the command line then. 



=================================================================
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]

Reply via email to