On Monday, 3 October 2022 at 15:56:02 UTC, Paul Backus wrote:
Shouldn't this read
Unspecified Value: If a void initialized variable's value
is used
before it is set, its value is unspecified.
Yes, it should. Many of the contributors to the D spec are not
very well versed in the
On Monday, 3 October 2022 at 14:37:35 UTC, kdevel wrote:
On Sunday, 2 October 2022 at 23:37:26 UTC, ryuukk_ wrote:
I got the answer thanks to IRC chat:
https://dlang.org/spec/declaration.html#void_init
Quote:
Implementation Defined: If a void initialized variable's
value is used
On Sunday, 2 October 2022 at 23:37:26 UTC, ryuukk_ wrote:
I got the answer thanks to IRC chat:
https://dlang.org/spec/declaration.html#void_init
Quote:
Implementation Defined: If a void initialized variable's value
is used
before it is set, its value is implementation defined.
On 10/3/22 09:35, tsbockman wrote:
On Sunday, 2 October 2022 at 23:45:45 UTC, drug007 wrote:
It works but not as someone could expect. In case of
```D
Foo[2] arr = void;
```
`arr` value is not defined, it is not an initialized array of
uninitialized elements like you want, it is just
On Sunday, 2 October 2022 at 23:30:16 UTC, ryuukk_ wrote:
```D
MyStruct test = void;
```
Does this guarantee that the compiler will not initialize it?
It's more of a request, than a guarantee. For example, `= void`
may be ignored for the fields of `struct`s and `class`es:
```D
struct ABC {
On Sunday, 2 October 2022 at 23:45:45 UTC, drug007 wrote:
It works but not as someone could expect. In case of
```D
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.
This is incorrect. It
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?
I got the answer thanks to IRC chat:
https://dlang.org/spec/declaration.html#void_init
I have tried to look at the documentation and various places on
the DMD source, but i couldn't find the answer
```D
MyStruct test = void;
```
Does this guarantee that the compiler will not initialize it?
Does it work with static arrays of struct too?
The generated code is different than