best/proper way to declare constants ?

Steven Schveighoffer schveiguy at gmail.com
Thu Aug 5 02:06:13 UTC 2021


On 8/4/21 9:14 PM, H. S. Teoh wrote:
> Unless you have a specific reason to, avoid using `enum` with string and
> array literals, because they will trigger a memory allocation *at every
> single reference to them*, which is probably not what you want.

Just want to chime in and say this is NOT true for string literals. Only 
array literals.

-Steve


More information about the Digitalmars-d-learn mailing list