home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mcsun!sunic!lth.se!newsuser
- From: dag@control.lth.se (Dag Bruck)
- Subject: Re: enum labels
- Message-ID: <1992Nov9.075707.21496@lth.se>
- Keywords: enum labels
- Sender: newsuser@lth.se (LTH network news server)
- Organization: Department of Automatic Control, Lund, Sweden
- References: <4026@bcstec.ca.boeing.com> <542@ulogic.UUCP>
- Date: Mon, 9 Nov 1992 07:57:07 GMT
- Lines: 23
-
- In <comp.lang.c++> hartman@ulogic.UUCP (Richard M. Hartman) writes:
- >
- >I posted a kvetch about this a little while ago. I agree that
- >allowing overloading of the simple types (int long float etc)
- >could lead to massive confusion and hard to find bugs, but an
- >enum is NOT a simple type, and does not need the same protections.
-
- The C++ standardization committee has voted to allow overloading based
- on enumerations, e.g.,
-
- enum Status {Fatal, Bad, Good};
-
- Status operator | (Status a, Status b)
- {
- if (int(a) < int(b))
- return a;
- else
- return b;
- }
-
- I believe some compilers already permit it.
-
- -- Dag
-