delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/04/06:31:32

Date: Tue, 4 Mar 1997 13:21:43 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Jon A. Cruz" <jonc AT twinsun DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: [Q] What #defines for cross-platform
In-Reply-To: <331B3412.FF4@twinsun.com>
Message-ID: <Pine.SUN.3.91.970304132128.12059E-100000@is>
MIME-Version: 1.0

On Mon, 3 Mar 1997, Jon A. Cruz wrote:

> I have a quick question. I'm working on some code for true
> cross-platform compiling (i.e. DOS, MS Windows, Windows CE, Unix, Mac,
> Newton, etc., not just Win95 and WinNT) and was looking for suggestions
> on what #defines I should use?
> 
> What are you using, and why?

Use __DJGPP__ for DJGPP-specific code, __MSDOS__ for MSDOS-specific
code (that should work for other MSDOS compilers as well), WIN32 or
_WIN32 for Windows 9x/NT platforms.

However, it is usually a better idea to try to identify the
functionality that is specific to different platforms, because some
platforms have similar features.  For example, both MSDOS and Windows
(and OS/2) have drive letters and backslashes in the pathnames, so you
might define a symbol, say, MS_PATHNAMES that is non-zero on all these
platforms, and condition code fragments on that symbol, instead of
enumerating all the systems that should use it.  A project-wide header
can then define MS_PATHNAMES for all the different platforms.

- Raw text -


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