Static inline field initialization

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 22 06:53:05 PDT 2017


s/buf/bug/

On Tue, Aug 22, 2017 at 3:52 PM, Daniel Kozak <kozzi11 at gmail.com> wrote:

> On Tue, Aug 22, 2017 at 2:20 PM, Moritz Maxeiner via Digitalmars-d <
> digitalmars-d at puremagic.com> wrote:
>
>> On Tuesday, 22 August 2017 at 11:50:50 UTC, Jonas Mminnberg wrote:
>>
>>> ...
>>
>>
>> I agree that it can be confusing if you try to read it with C++ semantics
>> [1]; the solution, however, imho is not to change D semantics or throw
>> warnings [2], but to refer to the D spec [3], which states that static
>> initialization of class members is used instead of default initialization
>> (before any constructors are run). To me that means a statically
>> initialized class field shall have the same value in all class instances,
>> i.e. it's not silent sharing, you explicitly requested the sharing.
>>
>
> What? D spec does say nothing about sharing, its only speak about order,
> nothing else. So it is a buf from my POV.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20170822/edb7625a/attachment.html>


More information about the Digitalmars-d mailing list