From: Keith Thompson <kst-u@mib.org>
Subject: Re: C++ diaries...
Date: Fri, 07 Jun 2019 16:09:29 -0700
Date: 2019-06-07T16:09:29-07:00 [thread overview]
Message-ID: <ln5zphro0m.fsf@kst-u.example.com> (raw)
In-Reply-To: lna7ets1al.fsf@kst-u.example.com
Keith Thompson <kst-u@mib.org> writes:
> Olivier Henley <olivier.henley@gmail.com> 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 <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
next prev parent reply other threads:[~2019-06-07 23:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 16:32 C++ diaries Olivier Henley
2019-06-06 16:54 ` Olivier Henley
2019-06-07 7:32 ` Maciej Sobczak
2019-06-07 17:55 ` Olivier Henley
2019-06-07 18:22 ` Keith Thompson
2019-06-07 23:04 ` Olivier Henley
2019-06-07 23:09 ` Keith Thompson [this message]
2019-06-07 18:29 ` Lucretia
2019-06-07 23:27 ` Olivier Henley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox