Manifest constants (was const again)

Janice Caron caron800 at googlemail.com
Sat Dec 8 12:01:12 PST 2007


On 12/8/07, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
> The enum proposal was just to make enum take over for const in declaring
> manifest constants.  Not to change the behavior of manifest constants.
>
> So whatever const s = "hello" does now in D2 should be what it does in
> the next iteration with enum s = "hello".

What I'm getting at is, enums have no storage. You can't take the
address of an enum (wheras you /can/ take the address of
const-declared things). The impact of that is obvious, for primitive
types like ints, but string is not a primitive type - it is an
aggregate; an array.

So the question I'm asking is, do the actual bytes of the array
consume runtime storage space? It's not completely obvious to me that
the answer would be yes.



More information about the Digitalmars-d mailing list