Message-Id: <1.5.4.32.19970731133711.0068ce34@dce03.ipt.br> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Thu, 31 Jul 1997 10:37:11 -0300 To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire), djgpp AT delorie DOT com From: Cesar Scarpini Rabak Subject: Re: sizeof() in #if Precedence: bulk At 05:12 27/07/97 GMT, Paul Derbyshire wrote: > >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 I'm affraid that what was being discussed is something different and earlier of the stage the solution of yours would apply: the configure script GNU software uses attempts to detect the existence and afterwads the properties of the C compiler in the installation executing a 'echo main{} > foo.c' and 'cc foo.c' then looking if a a.out file was generated. If so it does some more complicated tests to check for some properties of the compiler. The question is: in the MS-DOG environment, the C compiler can be anything, but in general will _not_ be called by 'cc'. In the years I worked with C compilers in DOS I've seen CL for Microsoft, TCC and BCC for Borland (command line only), WCL for Watcom and SC for Symantec (former Zortech which was ZC if memory does not betray me...). So I think the earlier advice of letting the user configure manually the compiler is the best one after of all! OTH, _in the sources_ the macro approach can be useful. If people in this ng needs info on the macros of these compilers, I may search for them and post them here, or alternatively, e-mail them on individual basis. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Cesar Scarpini Rabak E-mail: csrabak AT ipt DOT br DME/ASC Phone: 55-11-268-3522 Ext.350 IPT - Instituto de Pesquisas Tecnologicas Fax: 55-11-268-5996 Av. Prof. Almeida Prado, 532. Sao Paulo - SP 05508-901 BRAZIL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~