From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: boolean Date: Wed, 07 May 1997 20:59:57 -0700 Organization: Alcyone Systems Lines: 45 Message-ID: <33714FBD.443060CF@alcyone.com> References: <33712D3E DOT 6F0C AT icgroup DOT net> 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 Precedence: bulk lab wrote: > Is enum Boolean {false,true}; > > Supported in djgpp?......In Borland this ok.. It is not standard anything. I used to use Borland C (Turbo C 2.0, in fact). It was a good compiler, but a lot of the extensions and extra functionality included is not rigidly distinguished. (e.g., "This feature is not ANSI C and may not be available in other compilers.") For Turbo C 2.0, in particular, there were some features which were _listed_ as being ANSI C compliant but in fact were not. In C++ 2.1 (which DJGPP supports) there is the fundamental bool datatype, with keywords (not enum names) true and false. Implicitly converting back and forth between int and bool will do the right thing; that is, (bool) 2 is true. You can at least get the basic functionality by using something like the following: #ifdef BOOL typedef int bool; #define false 0 #define true 1 #endif If you're using a compiler which supports bool, then everything just works in the rest of your program. If it doesn't, then all you need to do define BOOL in your command line parameters or your perfix file (if you're using Think C/CodeWarrior). This won't get you the automatic coercion, but it will get you the implicit typecasting in C++ (where int i = true wouldn't work if true were an enum name). -- 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 \ "The future / is right there." / Bill Moyers