[ale] Kinda Off Topic

Mike Kachline kachline at cc.gatech.edu
Wed Dec 2 21:29:36 EST 1998


On Wed, 2 Dec 1998, Ryan wrote:

>     I have a programming question for y'all.  I have been studying C &
> C++ for a few years now and have wondered if there is a macro which I
> can use in the pre-processing code that will auto-magically determine
> whether I am using a DOS based system or LINUX.  I have begun to write
<snip>

	Ryan,

	Though I don't know *definitavely*, my impression has been that
compilers usually do implicitely make defines about the underlying OS, but
these defined values are pretty much compiler dependent. I'm *pretty* sure
that gcc or egcs on a linux box will always pre-define "linux" at compile
time (hopefully someone can correct me if I'm wrong here, that and take a
look at your /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/specs file if you
are running RH 5.2). 

	My best guess would be to look at the compilers you are using,
then hunt around for what they pre-define usually. As mentioned above, gcc
and egcs usually pre-define "linux" and "unix".

							Hope this helps,
								- Mike
============================================================================
Michael Kachline - CS, Georgia Tech
kachline at cc.gatech.edu
http://brightstar.gt.ed.net/kachline/
============================================================================






More information about the Ale mailing list