Preproccessor conditional compilation
I have a question about compiliation with the preproccessor:
Code:
#ifdef __UNIX__
/*...etc... */
What do you compile differently and all that if it's Unix? You know what machine you are compiling on, so what is conditional compilation used for? Isn't code compiled into machine code and linked? Then why would you need conditional compilation? Thanks...
--Garfield
Re: Preproccessor conditional compilation
Quote:
Originally posted by Garfield
I have a question about compiliation with the preproccessor:
Code:
#ifdef __UNIX__
/*...etc... */
What do you compile differently and all that if it's Unix? You know what machine you are compiling on, so what is conditional compilation used for? Isn't code compiled into machine code and linked? Then why would you need conditional compilation? Thanks...
--Garfield
Because, you might want to write stuff that will work on more than one system. So, you want it to compile in Windows, Linux, all flavors of unix, etc.
trust me, in the Unix world, porting code cross-platforms is a daily occurance for many people. This makes their lives easier.