January 26, 2015 enum, immutable or const for run-time constants? | ||||
---|---|---|---|---|
| ||||
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) |
January 26, 2015 Re: enum, immutable or const for run-time constants? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw Attachments: | 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`.
|
Copyright © 1999-2021 by the D Language Foundation