From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a02:b68f:: with SMTP id i15mr30009314jam.107.1559948689206; Fri, 07 Jun 2019 16:04:49 -0700 (PDT) X-Received: by 2002:aca:3256:: with SMTP id y83mr5490885oiy.110.1559948688944; Fri, 07 Jun 2019 16:04:48 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!g15no295671itd.0!news-out.google.com!l135ni348itc.0!nntp.google.com!s188no301696itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 7 Jun 2019 16:04:48 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=208.114.128.53; posting-account=MRPdDAoAAADUJmZVjnYaoafXFMadSeY1 NNTP-Posting-Host: 208.114.128.53 References: <60027108-2b92-417e-8083-eef19cc1e64a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: C++ diaries... From: Olivier Henley Injection-Date: Fri, 07 Jun 2019 23:04:49 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:56545 Date: 2019-06-07T16:04:48-07:00 List-Id: On Friday, June 7, 2019 at 2:22:44 PM UTC-4, Keith Thompson wrote: > The concept of enum in C++ is not what you wanted it to be. > C's enum types are derived directly from C's. In C, which does not > support overloading of identifiers, enumeration constants are of type > int. For example: > > enum color { red, green, blue }; > > defined "enum color" as a discrete type, and "blue" as a constant > equivalent to a literal 2. C++ tightens this up slightly by making > the constants be of the enum type (mostly, I think, to allow the > constants to be used with overloaded functions), but they're still > freely assignable to and from integer types. > More recently, C++ added a new "enum class" feature which is closer to > what you want enums to be -- but the older form goes back to the 1980s, > and there are uncounted lines of code depending on it. > Making C enums strongly typed from the beginning would have caused > problems *in the environment in which the language was defined > and used*. Changing them in an incompatible way would have broken > existing code. > Ada was designed with a different philosophy. I know all this. These facts do not absolve an absurd design and all the man hours it cost for decades. Life is short sir. I say we should struggle for better ways than accepting 'absurdly clashing identifiers' ... as a status quo of design.