From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: [Q] What #defines for cross-platform Date: Mon, 03 Mar 1997 21:24:06 -0800 Organization: Alcyone Systems Lines: 49 Message-ID: <331BB1F6.16ABE34B@alcyone.com> References: <331B3412 DOT FF4 AT twinsun DOT com> NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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? Uh, that's a huge, massive question. First, Newton? Newton programming, as far as I know, is done with NewtonScript, which is not C/C++, and so cross-platform compiling between other platforms is impossible, since NewtonScript does not exist on other platforms. Others are welcome to correct me if there's some new development in Newton programming. Second, it depends on what kind of cross-platform development you're trying to do. Most of my recreational work is (ANSI C) cross-platform stuff, so I might be able to help. If you're interested in graphics, sound, or other things, then there are no "#defines" you can make to make things cross-platform; you have to write a layer that interfaces between your code and the platform-specific code to do the job. This is often not easy, since different systems have different advantages and paradigms, and so making them all mesh nicely is not easy (but possible). First off is probably creating some typedefs for integral datatypes, since ANSI C/draft standard C++ does not strictly specify the sizes of the datatypes. Having types like signed16, unsigned32, etc., can help when the sizes of the types matter. You'll also tend to have defines and typedefs for things which _are_ standard but aren't yet supported on a particular compiler; for instance, I use the new C++ standard bool datatype even though it's not universally supported. On MetroWerks CodeWarrior 9 (I haven't bothered to check 10 or 11), it isn't supported yet, so typedefs and defines are required to make an object which _looks_ like a bool (although one generally has to be careful because simple defines don't get all the features of the C++ bool). You'd probably have to go into more detail about exactly what it is you're looking for. Cross-platform programming is a huge, wide-open subject. -- Erik Max Francis, &tSftDotIotE / email: max AT alcyone DOT com Alcyone Systems / web: http://www.alcyone.com/max/ San Jose, California, United States / icbm: 37 20 07 N 121 53 38 W \ "I am become death, / destroyer of worlds." / J. Robert Oppenheimer (quoting legend)