enum, immutable or const for run-time constants?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 26 12:12:30 PST 2015


On Mon, 26 Jan 2015 20:04:58 +0000, Nordlöw wrote:

> What's the preferred way of declaring run-time constant values in D from
> the point of view of
> 
> 1, compile-time performance 2. run-time performance 3. code-size 4.
> load-time 5. locality of reference module global or function global
> (static)

`const`/`immutable` is going to binary. `enum` is not. so it you don't 
need it in memory, use `enum`.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150126/26986fe3/attachment.sig>


More information about the Digitalmars-d-learn mailing list