Stop using the enum as a manifest constant.
Jack Applegame
japplegame at gmail.com
Sun Jun 6 10:40:13 UTC 2021
On Sunday, 6 June 2021 at 10:24:54 UTC, evilrat wrote:
> Nah, that enum arrays specifically,
Except for character arrays. Just change `int[]` to
`char[]`/`wchar[]`/`dchar[]`.
```asm
void example.useEnum():
push rbx
lea rbx, [rip + .L.str]
mov edi, 3
mov rsi, rbx
call @nogc void example.sideEffect(const(char[]))@PLT
mov edi, 3
mov rsi, rbx
pop rbx
jmp @nogc void example.sideEffect(const(char[]))@PLT
void example.useConst():
push rbx
lea rbx, [rip + .L.str]
mov edi, 3
mov rsi, rbx
call @nogc void example.sideEffect(const(char[]))@PLT
mov edi, 3
mov rsi, rbx
pop rbx
jmp @nogc void example.sideEffect(const(char[]))@PLT
```
> deprecating this specific case is probably ok though.
That's not enough. Let's deprecate any use of enum as a manifest
constant.
More information about the Digitalmars-d
mailing list