Date: Tue, 4 Mar 1997 13:21:43 +0200 (IST) From: Eli Zaretskii To: "Jon A. Cruz" cc: djgpp AT delorie DOT com Subject: Re: [Q] What #defines for cross-platform In-Reply-To: <331B3412.FF4@twinsun.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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.