Topic: Formalize the current compiler and platform
Author: qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk)
Date: Thu, 8 Mar 2001 23:56:11 GMT Raw View
Thu, 8 Mar 2001 17:48:17 GMT, Daryle Walker <dwalker07@snet.net.invalid>=
pisze:
> I was think of the target platform (Cygwin in your example). Maybe I
> should be more specific and have a __TARGET_PLATFORM__ and a
> __SOURCE_PLATFORM__ for the destination and compiler platforms,
> respectively.
Platform-dependent conditions should not rely on comparison of "the
platform" enumeration to known values, but on checking predicates.
Like "is this a Posix environment", or "is this an X/Open comforming
environment", or "is this a Windows environment". Because they are
not mutually exclusive.
When a platform is an extension to another, it should not be
forced to choose one of two things: define a new name (breaking all
programs which recognize the former name only) or don't allow to be
distinguished. Instead it should say that it supports both the old
interface and some extensions.
It's not an enumeration, it's a power set...
--=20
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZAST=CAPCZA
QRCZAK
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]
Author: comeau@panix.com (Greg Comeau)
Date: Fri, 9 Mar 2001 21:57:56 GMT Raw View
In article <1epwnf0.o19xua1fxb86oN%dwalker07@snet.net.invalid>,
Daryle Walker <dwalker07@snet.net.invalid> wrote:
>...I should be more specific and have a __TARGET_PLATFORM__ and a
>__SOURCE_PLATFORM__ for the destination and compiler platforms,
>respectively.
What is the problem trying to be solved by these?
And how will the above help it?
Of what formal (programatic?) use is it?
--
Greg Comeau Comeau C/C++ 4.2.45 "so close"
ONLINE COMPILER ==> http://www.comeaucomputing.com/tryitout
4.2.45.2 during March! NEW ONLINE: Try out our C99 mode!
comeau@comeaucomputing.com http://www.comeaucomputing.com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]
Author: dwalker07@snet.net.invalid (Daryle Walker)
Date: Tue, 6 Mar 2001 01:33:11 GMT Raw View
When I look at code that needs to specialize on a particular compiler
(MSVC++, CodeWarrior, etc.) or a particular platfrom (Windows NT, Mac,
etc.), it is done by checking for the presence (or absence) of a
particular #define constant. I guess this means that, for platforms,
all compilers for a platform have to make sure that the particular
symbol is #defined. Shouldn't we have something better than
exhaustively checking for certain #defines when we need to know what
we're using? I think we need something like __FILE__ and __LINE__,
maybe __COMPILER__ and __PLATFORM__.
Should we extend this for checking particular compiler options? Maybe
something like __feature(XX)__ would expand to the compiler's XX
setting.
--
Daryle Walker
Mac, Internet, and Video Game Junkie
dwalker07 AT snet DOT net
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]
Author: fjh@cs.mu.OZ.AU (Fergus Henderson)
Date: Wed, 7 Mar 2001 17:15:19 GMT Raw View
dwalker07@snet.net.invalid (Daryle Walker) writes:
>When I look at code that needs to specialize on a particular compiler
>(MSVC++, CodeWarrior, etc.) or a particular platfrom (Windows NT, Mac,
>etc.), it is done by checking for the presence (or absence) of a
>particular #define constant. I guess this means that, for platforms,
>all compilers for a platform have to make sure that the particular
>symbol is #defined. Shouldn't we have something better than
>exhaustively checking for certain #defines when we need to know what
>we're using? I think we need something like __FILE__ and __LINE__,
>maybe __COMPILER__ and __PLATFORM__.
What would they be defined to?
If they were strings, you couldn't use them in `#if'.
And what would __PLATFORM__ be in the case of e.g. a cross-compiler
from MacOS 10 (a mixture of Mac and Unix) to Cygwin (a Unix emulation
library on Windows)?
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]
Author: dwalker07@snet.net.invalid (Daryle Walker)
Date: Thu, 8 Mar 2001 17:48:17 GMT Raw View
Fergus Henderson <fjh@cs.mu.OZ.AU> wrote:
> dwalker07@snet.net.invalid (Daryle Walker) writes:
> >When I look at code that needs to specialize on a particular compiler
> >(MSVC++, CodeWarrior, etc.) or a particular platfrom (Windows NT, Mac,
> >etc.), it is done by checking for the presence (or absence) of a
> >particular #define constant. I guess this means that, for platforms,
> >all compilers for a platform have to make sure that the particular
> >symbol is #defined. Shouldn't we have something better than
> >exhaustively checking for certain #defines when we need to know what
> >we're using? I think we need something like __FILE__ and __LINE__,
> >maybe __COMPILER__ and __PLATFORM__.
I got the idea from reading that Ada had a (string?) variable with the
platform type. If they standardized it, why can't we; and we need it.
> What would they be defined to?
> If they were strings, you couldn't use them in `#if'.
They could be strings. We would have to revise the preprocessor to do
string comparisons. Within an #if line, we don't have to have the
normal compilation rules apply, since no token has been mapped to a
compiled item (literal, identifier, keyword, etc.) yet.
> And what would __PLATFORM__ be in the case of e.g. a cross-compiler
> from MacOS 10 (a mixture of Mac and Unix) to Cygwin (a Unix emulation
> library on Windows)?
I was think of the target platform (Cygwin in your example). Maybe I
should be more specific and have a __TARGET_PLATFORM__ and a
__SOURCE_PLATFORM__ for the destination and compiler platforms,
respectively.
--
Daryle Walker
Mac, Internet, and Video Game Junkie
dwalker07 AT snet DOT net
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]