enums
H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 30 10:21:22 PDT 2014
On Fri, May 30, 2014 at 07:17:15PM +0200, Philippe Sigaud via Digitalmars-d-learn wrote:
> > In D enum can be used to define manifest constants. This means
> > constants known at compile time. In practice for a double there
> > isn't a lot of difference. In general you can't take the address of
> > a manifest constant, unlike immutables.
>
> Because they do not exist as 'variables' or symbol in the generated
> code. They are directly replaced by their computed value.
One has to admit, though, that the choice of 'enum' as keyword is a bit
unfortunate, since most newbies (and some not-so-newbies) understand it
as "enumeration" rather than "manifest constant". It makes sense in
retrospect, but is quite counterintuitive for first-timers.
T
--
I think Debian's doing something wrong, `apt-get install pesticide',
doesn't seem to remove the bugs on my system! -- Mike Dresser
More information about the Digitalmars-d-learn
mailing list