enum str = "abc"; vs string str = "abc";

Victor Porton porton at narod.ru
Wed Jan 16 19:03:13 UTC 2019


On Wednesday, 16 January 2019 at 18:50:51 UTC, H. S. Teoh wrote:
> On Wed, Jan 16, 2019 at 06:21:29PM +0000, Victor Porton via
>> What of the two you would recommend?
>
> Use:
> 	immutable str = "...";
>
> in module-global scope. Or if this is inside a function,
>
> 	static immutable str = "...";
>
> This places it in the data section of the object file and 
> elides the extra pointer/size pair of `str` if it were mutable.

I haven't got what is your argument pro `immutable str` and so 
against enum.


More information about the Digitalmars-d mailing list