Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!caesar.cs.montana.edu!ogicse!emory!hubcap!rajarar From: rajarar@hubcap.clemson.edu (Bala Rajaraman) Newsgroups: gnu.g++ Subject: Enumeration Problem (Simple) Keywords: Switch, Enumeration Message-ID: <7570@hubcap.clemson.edu> Date: 5 Jan 90 02:17:32 GMT Distribution: na Organization: Clemson University, Clemson, SC Lines: 34 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. ------------------------------------------------------------------------- #include #include main() { enum keys {ASM,AUTO,BREAK}; keys key; key = 4; switch (key) { case ASM: break; case AUTO: break; } cout << "KEY = " << key << "\n"; } ------------------------------------------------------------------------- Is this feature not available in g++ ?? If this is a trivial question, I apologize. I do not have the GNU G++ User Guide as yet. Thanks Bala :-) rajarar@hubcap.clemson.edu