memory usage of an object's member functions

R

Randy Yates

If a member function uses no static local variables, then is only one
"pure root" of that member function's code used by all instantiated
objects or is its code duplicated for each instantiated object?
 
V

Victor Bazarov

Randy said:
If a member function uses no static local variables, then is only one
"pure root" of that member function's code used by all instantiated
objects or is its code duplicated for each instantiated object?

Usually, if the function is not declared 'inline' (either explicitly or
implicitly), the compiler has no reason to duplicate its body anywhere,
so, _usually_ only one body of any function exists in the final code.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,153
Latest member
NamKaufman
Top