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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: C++ diaries... Date: Fri, 07 Jun 2019 16:09:29 -0700 Organization: None to speak of Message-ID: References: <60027108-2b92-417e-8083-eef19cc1e64a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="2f9c4eb257206e8a03efe69db2d64894"; logging-data="18651"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19NGBYcYgKJMvr5EjFBayd+" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:WLGGQ6VSEvaNTL0PDtn6SxkTmdU= sha1:AjSKry9nTBhFw1e9KKeM7ei9cKE= Xref: reader01.eternal-september.org comp.lang.ada:56546 Date: 2019-06-07T16:09:29-07:00 List-Id: Keith Thompson writes: > Olivier Henley writes: > [...] >> I already said so, all of the above. The thing, 'straight enums', >> should have worked properly day one. The concept of enum in C++ is >> arguably deceitful, wrong, broken, you name it. > [...] > > 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 Typo, I meant to say that C++'s enum types are derived directly from C's. > 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. Correction, C++ doesn't allow implicit conversion from an integer type to an enum type. (C does.) [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */