Reordered class fields?

bearophile bearophileHUGS at lycos.com
Wed Oct 31 03:55:41 PDT 2012


Peter Summerland:

> The order of the fields is rearranged for packing. Does that 
> affect the tupleof property? The example in 
> http://dlang.org/class.html for Class properties tulpleof seems 
> to implie that the the fields the returned Expression Tuple are 
> arranged in lexical order (i.e., as defined by the programmer 
> in the class definition). Is this always true for classes?

I have added your question here:
http://d.puremagic.com/issues/show_bug.cgi?id=8873


> What about structs?

D structs are almost PODs (if they are nested inside a function 
and they are not defined as static they have one more field at 
the beginning), so tupleof for structs gives the fields in 
definition order.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list