From owner-freebsd-questions Wed Apr 3 15:42:43 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id PAA04559 for questions-outgoing; Wed, 3 Apr 1996 15:42:43 -0800 (PST) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id PAA04553 for ; Wed, 3 Apr 1996 15:42:37 -0800 (PST) Received: from msmith@localhost by genesis.atrad.adelaide.edu.au (8.6.12/8.6.9) id JAA22021; Thu, 4 Apr 1996 09:36:14 +0930 From: Michael Smith Message-Id: <199604040006.JAA22021@genesis.atrad.adelaide.edu.au> Subject: Re: How do you declare an enum ? To: dwhite@resnet.uoregon.edu Date: Thu, 4 Apr 1996 09:36:13 +0930 (CST) Cc: questions@FreeBSD.ORG In-Reply-To: from "Doug White" at Apr 3, 96 09:23:18 am MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Doug White stands accused of saying: > > What is the gcc way of declaring an enum? Same as normal C. > 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? Compiles fine here. I suspect that you've got another 'true', 'false' or 'boolean' in scope. If you're trying to define a boolean type, you want : typedef enum {false, true} bool_t; If you just want two constants, one false, the other true, use #define FALSE (0) #define TRUE (!FALSE) > Doug White | University of Oregon -- ]] Mike Smith, Software Engineer msmith@atrad.adelaide.edu.au [[ ]] Genesis Software genesis@atrad.adelaide.edu.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control (ph/fax) +61-8-267-3039 [[ ]] Collector of old Unix hardware. "Where are your PEZ?" The Tick [[