LDC, ARM: unnecessary default initialization

kinke via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 18 05:09:04 PDT 2017


On Friday, 18 August 2017 at 09:42:25 UTC, Jack Applegame wrote:
> For some reason, the LDC default initializes the structure, 
> even if initialization of all its members is specified as void. 
> I believe that this is wrong.

Afaik, this has been brought up multiple times already and is so 
by design. Every aggregate has an init symbol, omitting that (and 
accordingly the default initialization of all instances) by 
initializing each field with void doesn't work. The 
initialization isn't performed fieldwise, but is a bitcopy of 
T.init.
You can skip initialization of specific instances though - `S s = 
void;` - but again not if `s` is a field of another aggregate.


More information about the Digitalmars-d mailing list