This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Predefining __OS_DOS__
Jeffrey A Law wrote:
> > Up to now, `MSDOS', `_WIN32' and `__EMX__' always occured in
> > this combination in the GPC project. Sometimes someone forgot
> > one (or two) of them and caused unpleasant bugs. I don't know,
> > but I can imagine that similar things have happened in the C
> > world, too.
> True. This can be a problem. But I'd prefer people to actually think about
> the code they write instead of depending on this kind of crutch.
>
> I'd think it is just as likely that someone will start using __OS_DOS__ for
> code they think is common to dos-like systems, when in fact it is not common
> to all the dos-like systems.
>
> Additionally, less and less code in the compiler should be conditional on
> host defines of this nature. Instead we should be depending on autoconf
> macros and defines which indicate the availability or non-availability of
> specific features. This is the general direction most FSF code is taking
> and __OS_DOS__ seems to me like a step backwards.
In most other cases I would agree, but ports of GNU software to
MS-DOS-like systems have always been somewhat special rather
than part of the main line. These ports being all independent
resulted in independent, unsystematic predefinitions. (There
are, for instance, also -D__MSDOS__, -D__WIN32__, -DWIN32, but
only the combination I mentioned has the intended effect of
identifying all MS-DOS-like systems.) I think it's time to
clean them up, and a common predefinition for all MS-DOS-like
systems is a step forward in this direction.
BTW, does anyone know whether autoconf works on MS-DOS?
> > This is confusing for Pascal programmers since there is no
> > symbol `||' in Pascal.
> But there's also no #ifdef in Pascal. If they can learn about #ifdef,
> #define and friends, they can learn about ||. :-)
There is (*$ifdef FOO *), (*$define FOO *), but no `||' in
Pascal. (In fact GNU Pascal does support `||' because its
preprocessor is a modified `cpp', but I consider C expressions
in a Pascal preprocessor a bug, not a feature, and I am not
planning to encourage their use in Pascal programs.)
> > There are no header files in Pascal. One would have to add this
> > to each source file.
> Err, if you're using cpp, then you have #include capabilities. How else are
> you testing #ifdefs?
Okay, it seems to be necessary to go a little deeper into the
details.
Pascal has include capabilities - (*$i Foo *) means
#include "foo.pas" - but they are not used for communication
between different modules of the same project. (Pascal provides
other mechanisms to achieve this.) Thus, a Pascal project
usually does not have "header" files included by all source
files.
Peter
--
Peter Gerwinski, Essen, Germany, http://home.pages.de/~Peter.Gerwinski/
Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-980830
PGP key on request - 6C 94 45 BE 28 A4 96 - 0E CC E9 12 47 25 82 75
Fight the SPAM and UBE! - http://spam.abuse.net/ - http://maps.vix.com/