On 10/3/22 02:30, ryuukk_ wrote:
I have tried to look at the documentation and various places on the DMD source, but i couldn't find the answer

https://dlang.org/spec/declaration.html#void_init


```D
MyStruct test = void;
```

Does this guarantee that the compiler will not initialize it?

Yes


Does it work with static arrays of struct too?


It works but not as someone could expect. In case of
```
Foo[2] arr = void;
```
`arr` value is not defined, it is not an initialized array of uninitialized elements like you want, it is just uninitialized array.

The generated code is different than ``MyStruct test;``

What exactly (by exactly i mean is the behavior documented somewhere?) ``void`` does?




Reply via email to