Property discussion wrap-up

Zach the Mystic reachBUTMINUSTHISzach at gOOGLYmail.com
Wed Jan 30 09:50:40 PST 2013


On Wednesday, 30 January 2013 at 17:42:48 UTC, TommiT wrote:
> On Wednesday, 30 January 2013 at 17:02:44 UTC, Zach the Mystic 
> wrote:
>> [..] 1) How hard to implement structs nested in structs to 
>> mimic ones nested in functions?
>
> Given:
>
> struct Outer {
>     struct Inner {
>         int n1;
>     }
>     int n2;
> }
>
> Outer.sizeof should be equal to 2 * int.sizeof, because there's 
> no point in introducing any overhead here. Whereas structs 
> inside functions do their magic by having an implicit pointer, 
> which increases their size. I don't think we want to introduce 
> any memory overhead with something as insignificant as 
> properties.

See my first answer to Dmitri's post. Most properties will hold 
no data of their own, and the compiler could detect this, thus 
eliminating the need for the pointer at runtime.


More information about the Digitalmars-d mailing list