Date: Wed, 14 Sep 94 09:05 PDT From: jdp AT polstra DOT com (John Polstra) To: djgpp AT polstra DOT com Subject: Re: named enum? > Can the named enumeration be implemented in DJGPP? For example, when > I compile the small program below: > > enum bool {false, true}; > void main () { > bool foo = false; > } > > the g++ told me: > > temp.cc:1: parse error before `bool'. There is nothing wrong with your program, except that you chose some very unlucky names for your enum and its members. The ANSI committee has added a new boolean type to the C++ language. The type is called "bool" and it can take on two values: "true" and "false". Thus "bool", "true", and "false" are now keywords. This was implemented in g++ starting with version 2.6.0. If you will, for example, change: bool to Bool true to True false to False in your program, it will work fine. (Or, just delete the first line of your program, and it will use the built-in boolean type.) Somebody else replied that you must put "enum" in front of bool foo = false; That is not correct. In C++, you can (and should, stylistically speaking) simply use the enum, struct, or union tag all by itself. John Polstra jdp AT polstra DOT com John D. Polstra & Co., Inc. Phone (206) 932-6482 Seattle, Washington USA Fax (206) 935-1262 "Self-knowledge is always bad news." -- John Barth