C++17 cannot beat D surely

Stanislav Blinov via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 3 14:23:00 PDT 2017


On Saturday, 3 June 2017 at 21:04:16 UTC, ag0aep6g wrote:
> On 06/03/2017 10:29 PM, Stanislav Blinov wrote:
>> Meep. Wrong :)
>> 
>> Static initializers for static variables and constants are 
>> evaluated at compile time, initializing them with runtime 
>> values is a compile-time error.
>
> Meep. Meep. I wouldn't say you're wrong, but there's nitpicking 
> to be done.
>
> You can't use a run-time value as the initializer, but you 
> *can* initialize a static variable with a run-time value: using 
> a static constructor.

Mental note to self: never write assuming sentences in a NG :)
You're correct, of course. I meant inline initialization, as 
presented in the code in question.


More information about the Digitalmars-d mailing list