Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 1996 13:29:39 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        dwhite@resnet.uoregon.edu
Cc:        questions@freebsd.org
Subject:   Re: How do you declare an enum ?
Message-ID:  <199604032029.NAA19898@phaeton.artisoft.com>
In-Reply-To: <Pine.BSF.3.91.960403092059.1411A-100000@riley-net170-164.uoregon.edu> from "Doug White" at Apr 3, 96 09:23:18 am

next in thread | previous in thread | raw e-mail | index | archive | help
> hello!
> 
> What is the gcc way of declaring an enum?
> 
> I have a line like this in a .h file:
> 
> enum boolean {false, true};
> 
> When I try to compile this, gcc (and g++) barfs on it, saying that there 
> is a parse error before 'false'.  
> 
> Is there a different way to declare an enum type?

You missed the meeting!  8-).

You are trying to enum a C++ reserved word.  This is a fairly recent
addition to the list of reserved words.

This would work in C, if there weren't an already existing typedef for
"boolean" (or a #define as an atomic type).

/usr/include/math.h uses this construct for fdversion without problems...


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604032029.NAA19898>