Multiple return values...

Mantis mail.mantis.88 at gmail.com
Mon Mar 12 02:46:45 PDT 2012


12.03.2012 6:01, Robert Jacques пишет:
> On Sun, 11 Mar 2012 21:49:52 -0500, Mantis <mail.mantis.88 at gmail.com> 
> wrote:
>> [...]
>> That's the point of discussion. Fields of structure may not be optimized
>> away, because they are not independent variables. In D you have
>> unchecked pointer-to-pointer casts, and results of these casts should
>> depend on target architecture, not on optimizer implementation. At
>> particular, if such optimizations are allowed, some C API will no longer
>> be accessible from D.
>
> Unused fields of a structure are optimized away _today_. Unless a 
> piece of code takes the address of the struct, all of the fields are 
> treated as independent variables.

I can't confirm: http://pastebin.com/YgBULGfe
Prints "42\n3.14\n", compiled with dmd -release on windows x86. How 
exactly did you find out that such optimization is performed?


More information about the Digitalmars-d mailing list