Whats going on with this?

Daniel Kozak kozzi11 at gmail.com
Sat Oct 3 20:46:46 UTC 2020


On Sat, Oct 3, 2020 at 10:40 PM Daniel Kozak <kozzi11 at gmail.com> wrote:

> I would say it is here you just need to read it carefully:
>
> https://dlang.org/spec/struct.html#static_struct_init
>
>
For case specification is change I will paste it here:
'''
If a StructInitializer is supplied, the fields are initialized by the
StructMemberInitializer syntax. StructMemberInitializers with the
Identifier : NonVoidInitializer syntax may be appear in any order, where
Identifier is the field identifier. StructMemberInitializers with the
NonVoidInitializer syntax appear in the lexical order of the fields in the
StructDeclaration.
'''

And StructMemberInitializer is defined as:

'''
StructMemberInitializer:
    NonVoidInitializer
    Identifier : NonVoidInitializer
'''

And NonVoidInitializer is defined as:

'''
NonVoidInitializer:
    ExpInitializer
    ArrayInitializer
    StructInitializer
'''

And as you can see there is ArrayInitializer

And there is definition of Array literals here
https://dlang.org/spec/expression.html#array_literals

and in section 2. there is this text:

'''
By default, an array literal is typed as a dynamic array, but the element
count is known at compile time. So all array literals can be implicitly
converted to static array types.
'''
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20201003/ce2217b1/attachment.htm>


More information about the Digitalmars-d-learn mailing list