delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/30/13:02:04

Date: Mon, 30 Apr 2001 19:23:20 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: JT Williams <jeffw AT darwin DOT sfbr DOT org>
cc: djgpp AT delorie DOT com
Subject: Re: __DJGPP__ and MSDOS
In-Reply-To: <20010430093758.A5379@kendall.sfbr.org>
Message-ID: <Pine.SUN.3.91.1010430192119.19343D-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 30 Apr 2001, JT Williams wrote:

> When are __DJGPP__ and __MSDOS__ guaranteed to be defined and valid for
> #ifdef testing?

Yes.

> My experiments lead me to believe that __MSDOS__ is defined `immediately'
> by the preprocessor (by virtue of using a gcc that was built for DOS),
> but that __DJGPP__ is not defined until I #include a *system* header.

That might be true (depending on what version of GCC do you use), but 
even if it is so, the necessary header is included by the preprocessor 
before anything else, because the specs file tells it to do so with the 
-isystem switch.

> Therefore, in the following sequence
> 
> #include "foo.h"
> #include <stdio.h>
> [rest of code]
> 
> I can validly #ifdef __MSDOS__ inside "foo.h", but I have to wait until
> _after_ <stdio.h> to validly #ifdef __DJGPP__?

No.  __DJGPP__ should work exactly like __MSDOS__.  If you see something 
else, please post a short test program.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019