Re: Do static variables in class consume memory of instances?

2021-07-22 Thread Mark Lagodych via Digitalmars-d-learn
On Thursday, 22 July 2021 at 16:05:41 UTC, Adam D Ruppe wrote: On Thursday, 22 July 2021 at 15:50:59 UTC, Mark Lagodych wrote: Do static variables consume *any* memory in instances, perhaps just for pointers to the variables? nope Or does compiler automatically convert

Re: Do static variables in class consume memory of instances?

2021-07-22 Thread Mark Lagodych via Digitalmars-d-learn
On Thursday, 22 July 2021 at 15:50:59 UTC, Mark Lagodych wrote: Do static variables consume *any* memory in instances, perhaps just for pointers to the variables? Figured it out. Let's try: ```d import std.stdio; class A { static int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;

Re: Do static variables in class consume memory of instances?

2021-07-22 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 22 July 2021 at 15:50:59 UTC, Mark Lagodych wrote: Do static variables consume *any* memory in instances, perhaps just for pointers to the variables? nope Or does compiler automatically convert `someObject.someStaticMember` to `SomeClass.someStaticMember`? right

Do static variables in class consume memory of instances?

2021-07-22 Thread Mark Lagodych via Digitalmars-d-learn
[D documentation](https://dlang.org/spec/attribute.html#static) says: Static data has one instance per thread, not one per object. Do static variables consume *any* memory in instances, perhaps just for pointers to the variables? Or does compiler automatically convert