enum and const or immutable ‘variable’ whose value is known at compile time

Adam D. Ruppe destructionator at gmail.com
Wed Sep 16 17:19:13 UTC 2020


On Wednesday, 16 September 2020 at 17:12:47 UTC, Cecil Ward wrote:
> then is there any downside to just using enum all the time?

For a non-string array, enum may give runtime allocations that 
static immutable won't.

Generally think of enum as being replaced with the literal 
representation and array literals actually make a new array.

This may or may not matter to you.


More information about the Digitalmars-d-learn mailing list