This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: The D Programming Language
- From: Tim Hollebeek <tim at hollebeek dot com>
- To: David Rasmussen <david dot rasmussen at gmx dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 28 Apr 2002 12:45:43 -0400
- Subject: Re: The D Programming Language
- References: <3CCC18B9.3060601@gmx.net>
- Reply-to: tim at hollebeek dot com
> The difference from enums is that
>
> 1. They don't implicitly cast to anything. I find that a source of bugs
> with enums.
>
> 2. They can't eventually end up having some undefined value, internally
> represented as 42 or something. This can happen with enums.
Worse, it is explicitly legal in C++. For example, there is nothing
wrong with: 'November | December' == 0x0c == nothing, which was an
explicit decision to preserve the validity of code that uses enums to
define bits.
This prevents compilers from optimizing or diagnosing invalid enum values.
-Tim