enum abuse
Steve Teale
steve.teale at britseyeview.com
Fri Feb 28 10:21:39 PST 2014
On Friday, 28 February 2014 at 11:47:45 UTC, Vladimir Panteleev
wrote:
> A "const" or "immutable" declaration would declare a constant
> variable - meaning, unless it is optimized out at a later
> point, it will end up in the data segment and have its own
> address. An enum declares a manifest constant - it exists only
> in the memory of the compiler. Manifest constants make sense
> when doing metaprogramming. Constant/immutable declarations
> make sense for values that will be used in multiple places by
> code at runtime.
I'm with Mike - thanks Vlad, that makes it perfectly clear. I
just wonder slightly why a language that prides itself so on its
metaprogramming capabilities does not have a keyword that makes
it obvious
Think of an abbreviation for compile-time-constant.
But yes, thanks.
BTW, why does an immutable integer type need to have an address?
Steve
More information about the Digitalmars-d-learn
mailing list