[Issue 19917] unions should require that all members are `= void` initialised
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 29 21:23:34 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19917
--- Comment #5 from kinke at gmx.net ---
Nah, I think LDC's way is fine, but it could be improved by *requiring*
(exactly) one field to be explicitly initialized - clear as day and not much
more syntax overhead:
union U {
int i;
float f = 1.0f;
real r;
}
vs.
union U {
int i = void;
float f = 1.0f;
real r = void;
}
and
union U {
int i = 0;
float f;
real r;
}
vs.
union U {
int i;
float f = void;
real r = void;
}
--
More information about the Digitalmars-d-bugs
mailing list