=void in struct definition

Stefan Koch uplink.coder at googlemail.com
Mon Apr 9 11:15:14 UTC 2018


On Monday, 9 April 2018 at 11:06:50 UTC, Shachar Shemesh wrote:
> struct S {
>   int a;
>   int[5000] arr = void;
> }
>
> void func() {
>   S s;
> }
>
> During the s initialization, the entire "S" area is 
> initialized, including the member arr which we asked to be = 
> void.
>
> Is this a bug?
>
> Shachar

Not semantically, but you might consider it a performance bug.
This particular one could be fixed, put I cannot say how messy 
the details are.
There is potential for code that silently relies on the behavior 
and would break in very non-obvious ways if we fixed it.


More information about the Digitalmars-d mailing list