Struct copies

Stanislav Blinov stanislav.blinov at
Mon Jan 27 16:45:48 PST 2014

It would seem that ldc is performing a memberwise assignment. It 
could probably be optimized away since it's known at compile time 
whether the fields have their own assignment overloaded or not. 
With unions it's straight: just a memcopy on the largest size 
(sadly dmd doesn't do that yet, but it also does all sorts of 
nasty things with unions). With structs it's a little more 

Generally though, pure code generation issues aside, that is one 
very strange swap function, bearophile :)

More information about the digitalmars-d-ldc mailing list