Mail Archives: djgpp/2002/04/07/14:23:35
> I don't think there's a general, compiler-independent way of getting
> that information. Each compiler should have this documented
> somewhere.
But then, the problem remains to select a proper compiler....
If I'm building an app. which needs to be cross-platform portable,
then this kind of decision is quite important.
If the compiler does not allow me to detect at least the kind of OS I'm
using,
it is of no use. ( I agree that the arch. specification need not be taken
from the
compiler, but at least the OS specs are needed).
For example, if I'm writing an app for say MS Win-32 platform, which
depending
on the kernel does some additional things, then the OS information is quite
imp.
Like, if I can find out if it is WinNT or Win9x, then probably my ways of
initialization may differ(e.g. initialization of threading subsystem).
Or maybe, I can restrict my app to run on say WinNT only.
AFAIK, if we follow GNU specs, then GNU defines certain #define macros which
allow
the programmer to find out the OS info (at least the version).
This makes life much easier.
I mean, then where do the macros __MSDOS__ or MSDOS come from, which allow
me
to see that the OS I'm using is an MSDOS compatible (???) or not??
Then, to select a proper compiler, I need to know all the internal details
of the compiler
& its interactions with the OS. Or at least, I have to spend some time
reading the docs
of the compiler for that.
If we follow certain specific rules, which will allow to generalize such a
task,
I think that'll be of great help to all.
Pls. correct me if I'm wrong anyway.
Because, I want to understand this to the max possible extent, since we have
a paper
on compilers in my next semester of MCA.
Kunal
----------------------
Behind every great computer sits a skinny little geek.
- Raw text -