Stop using the enum as a manifest constant.
Claude
claudemr at live.fr
Mon Jun 7 07:17:03 UTC 2021
On Sunday, 6 June 2021 at 10:47:54 UTC, Mathias LANG wrote:
> On Sunday, 6 June 2021 at 10:40:13 UTC, Jack Applegame wrote:
>>
>> That's not enough. Let's deprecate any use of enum as a
>> manifest constant.
>
> I wouldn't go that far. `enum` are like `#define`, and there
> *are* cases where you want them. E.g. when using them as define
> arguments:
> ```D
> void foo (char[] fmt = DEFAULT_VALUE) { /* ... */ }
> ```
Yes, and if the memory layout is like in C, I would expect
'immutable' variables to be addressable (in RO data segment), but
not 'enum' constants (which would be simple rvalues, probably
directly used as-is in assembly instructions).
More information about the Digitalmars-d
mailing list