www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [?bug/feature?] overwriting the .sizeof of structs

reply Thomas Kuehne <eisvogel users.sourceforge.net> writes:
struct TestStructSizeof{
        int sizeof;
}

TestStructSizeof s;

s.sizeof will be 0.

Is this a intended feature or a bug?
Jul 08 2004
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
i suppose it's supposed to be legal.. Walter implemented the .sizeof
property as not to conflict with structs that had a .size member.. although
you would think that declaring a member function as a keyword should be
illegal!

though .sizeof isn't really a keyword, is it?  it's more of an implicit
static member variable.  perhaps there should be code to prevent its being
overridden..

"Thomas Kuehne" <eisvogel users.sourceforge.net> wrote in message
news:ccja6c$18af$1 digitaldaemon.com...
 struct TestStructSizeof{
         int sizeof;
 }

 TestStructSizeof s;

 s.sizeof will be 0.

 Is this a intended feature or a bug?

Jul 10 2004