Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zaphod.mps.ohio-state.edu!rpi!batcomputer!lijewski From: lijewski@batcomputer.tn.cornell.edu (Mike Lijewski) Newsgroups: comp.std.c++ Subject: Re: request for comments Message-ID: <1991Feb3.212909.16251@batcomputer.tn.cornell.edu> Date: 3 Feb 91 21:29:09 GMT References: <95@tdatirv.UUCP> <70305@microsoft.UUCP> <1991Feb02.165526.1933@nowhere.uucp> Organization: Cornell National Supercomputer Facility Lines: 41 In article <1991Feb02.165526.1933@nowhere.uucp> sking@nowhere.uucp (Steven King) writes: >In article <70305@microsoft.UUCP> jimad@microsoft.UUCP (Jim ADCOCK) writes: >> >>a number of other ways to make derived types. Also, it has been pointed >>out to me that now that enums are distinct types, perhaps they too should >>be candidates for operator overloading: >> >>"An operator function must either be a member function or take at least one >>argument of class type, enum type, or of a type derived from a class >>or enum type." > > There are is a problem with allowing operator overloading, or even > operators at all, on enums. Given > > enum modes { rd_ok = 1, wr_ok = 2, ex_ok = 4 } ; > > for ( modes m = rd_ok ; m < ex_ok ; m++ ) // this is accepted by Cfront 2.0! > > What does _m++_ do? The problem with arbitrary arithmatic manipulations > of enum's are alluded to in ARM ( sorry, dont have the # ). It is a bug that m++ is accepted. In a ARM-conforming C++ implementation this would be a bug since what you have is m = (int)(m + 1); and integers cannot be assigned to enums. > >-- > ..!cs.utexas.edu!ut-emx!nowhere!sking > >been dazed and confused for so long its true; wanted an OS, never bargined for >you. Lotsa people hacking, few of them know, kernal of unix was created below... -- Mike Lijewski (H)607/272-0238 (W)607/254-8686 Cornell National Supercomputer Facility ARPA: mjlx@eagle.cnsf.cornell.edu BITNET: mjlx@cornellf.bitnet SMAIL: 25 Renwick Heights Road, Ithaca, NY 14850