default initialization of char arrays
Ogion
ogion.art at gmail.com
Wed Oct 1 18:09:27 UTC 2025
On Wednesday, 10 September 2025 at 23:35:29 UTC, JN wrote:
> I feel like in such scenario a warning should be issued, or
> even compilation error, "static array initialization expects 10
> values, only 1 provided". Sooner or later someone will hit the
> same issue again and spend hours debugging why the array
> doesn't get zeroed.
Yep, the syntax should be more explicit. Something like this:
```D
float[10] x = [42, ...]; // [42, NaN, ..., NaN]
float[10] y = [1:42, ...]; // [NaN, 42, NaN, ..., NaN]
```
More information about the Digitalmars-d
mailing list