default initialization of char arrays

pete email at email.com
Mon Sep 8 17:03:40 UTC 2025


On Monday, 8 September 2025 at 15:50:06 UTC, Walter Bright wrote:
> You can also use this for default initialization of structs:
>
> ```
> struct S { int a=1,b=2,c=3; char[10] x = 0; }
> ```

I didn't notice you could do that. In the past I have used 
something like this monstrous thing to make a static array of 
zero-initialised floats  :)

```
float[N] list = iota(0, N).map!((int i) => 
0).staticArray!(float[N]);
```



More information about the Digitalmars-d mailing list