does static class member change class size? 
Author Message
 does static class member change class size?

I've got a class in a DLL that applications use. If I add members,
even private ones, to my class the application has to recompile
because the size of the class (e.g. the chunk of memory allocated
when I new a class) increases. This is somewhat of a problem
because I have many applications running in many places.

Currently I'm contemplating adding a feature to the class that
could easily be represented by a private static data member (int)
Will adding a static member change the layout? In other words,
do I risk heap corruption if I add a static member and not recompile?
I'm guessing that statics class members are treated like global
variables by the linker but I'm not sure.

Thanks,
Andrew Queisser



Wed, 19 Nov 2003 06:40:50 GMT  
 does static class member change class size?
No. (You are correct).  Static class members belong to the class only in terms
of scope; they do not increase the size of the class objects, because they are
not associated with any single object.  Their storage is like global variables,
as you guessed.


Wed, 19 Nov 2003 09:41:03 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Class object as static member of another class

2. Creating a static class from non static Framework classes

3. how to call a non-static member function of a class from a static member function of the class?

4. accessing static member of Windows service class thro reflection - need help

5. Initialising a static data member of a Class?

6. Initialising a static data member of a Class?

7. static class members - ahh!!

8. Static member in C++ class

9. class with static string member problem

10. static member variable inside class

11. LNK1169 & static const class member variables

12. dll export of static const class members

 

 
Powered by phpBB® Forum Software