best/proper way to declare constants ?

someone someone at somewhere.com
Thu Aug 5 03:26:58 UTC 2021


On Thursday, 5 August 2021 at 02:43:09 UTC, Steven Schveighoffer 
wrote:
> The main difference between enums and static immutable is that 
> the latter has an address at runtime.

This. Gotcha.

> So the answer is, depends on what you are going to do with the 
> data. There are use cases for both. If you just want an alias 
> to represent the literal, I'd say use enum, it should work fine.

ACK. Now I understand the difference.

Thanks a lot for your detailed reply Steve !

One of the things D has as a plus is ... the community; very 
welcome indeed :)




More information about the Digitalmars-d-learn mailing list