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. 

-- 
Oleg Goldshmidt | [EMAIL PROTECTED]
who is currently trying to make some code he did not write work on
Linux without screwing up 5 or 6 other operating systems...

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