Property discussion wrap-up

Zach the Mystic reachBUTMINUSTHISzach at gOOGLYmail.com
Wed Jan 30 16:15:35 PST 2013


On Wednesday, 30 January 2013 at 22:30:10 UTC, TommiT wrote:
> On Wednesday, 30 January 2013 at 21:58:53 UTC, Zach the Mystic 
> wrote:
>> Also, because the "namespace_thingy"s have so much in common 
>> with structs, I think it would be misleading to call them 
>> something else.
>
> The problem of using empty struct variables is that they take 
> up memory. They have to, because you can make a pointer to a 
> variable and then you can dereference that variable. There has 
> to be at least a byte of memory to dereference.
>
> So, really, the only zero-overhead way to do this is to 
> introduce a new keyword that creates something that you can't 
> take the address of, because it kind of doesn't exist (like a 
> namespace). It exists only in the sense that it can be used to 
> tell the compiler which operators and functions to call. That's 
> what my namespace_thingy is.

I disagree. The compiler can easily tell if a struct is defined 
with no data, and simply optimize away the pointer in the process.


More information about the Digitalmars-d mailing list