delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/30/13:32:13

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: sizeof() in #if
Date: 27 Jul 1997 05:12:37 GMT
Organization: The National Capital FreeNet
Lines: 29
Message-ID: <5relc5$3ls@freenet-news.carleton.ca>
References: <199707251705 DOT KAA26965 AT adit DOT ap DOT net>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet2.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Nate Eldredge (eldredge AT ap DOT net) writes:
> At 05:34  7/24/1997 +0100, you wrote:
>>Now, how do I in a portable way test for which C compiler might be available?
>>I can do it easily in 4DOS, but COMMAND.COM compatibility is a lot harder...
> Well, there's always the method of <gasp> asking the user! My approach would
> be to define $(CC) = gcc at the top of the makefile, and let the user change
> it if they want.
> The better question is, what compiler besides GCC would be available that
> would work?

What about predefined macros? Info cpp macros predefined. There're bunch,
including I think, __GNU_C__ and __DJGPP__ in DJGPP. Presumably others
such as Microsoft C++ and Borland C++ have their own, like __BORLAND__.
Then you make conditional compile statements like so:


#if defined __GNU_C__
  putpixel(dx,dy,17);
#elif defined __BORLAND_C__
  plotpixel(dx,dy,17,NULL);
#else
  #error I only compile with DJGPP or Borland
#endif  
--
    .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
 -()  <  When I go to the theater, I always go straight to the "bag and mix"
    `*'  bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh

- Raw text -


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