🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++
Article #489

Re: Enumeration Problem (Simple)

#489
From: Doug Schmidt
Date: Fri, 05 Jan 1990 05:47
15 lines
1164 bytes
In article <7570@hubcap.clemson.edu>, rajarar@hubcap (Bala Rajaraman) writes:
>
>Stroustrup's C++ book indicates that if in a switch only a few of the 
>enumerated values are handled the compiler issues a warning [pg. 64-65].
>	In the following program the g++ compiler neither issues a warning, 
>nor does it prevent me from assigning an arbitrary value to a variable of 
>an enumerated type.

Try using the -Wall -Wenum-clash flag with g++.  This will warn about
the unused enum value in the switch and the assignment of an integer
to an enumeral.

  Doug
--
Douglas C. Schmidt
Technical Details
Message-ID: <25A4350F.11937@paris.ics.uci.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!orion.oac.uci.edu!uci-ics!gateway
References: <7570@hubcap.clemson.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!orion.oac.uci.edu!uci-ics!gateway
From: schmidt@glacier.ics.uci.edu (Doug Schmidt)
Newsgroups: gnu.g++
Subject: Re: Enumeration Problem (Simple)
Keywords: Switch, Enumeration
Message-ID: <25A4350F.11937@paris.ics.uci.edu>
Date: 5 Jan 90 05:47:59 GMT
References: <7570@hubcap.clemson.edu>
Reply-To: schmidt@glacier.ics.uci.edu (Doug Schmidt)
Distribution: na
Organization: University of California, Irvine - Dept of ICS
Lines: 15
In-reply-to: rajarar@hubcap.clemson.edu (Bala Rajaraman)