Hello,
I have a question regarding storage locations for different data types.
For example, dynamically created objects (using "new") are created on
the heap. local objects ( foo() {int x;} ) are on the stack.
1)Where are global non-const objects created?
2)Where are global const objects created?
3)For a function, where are local static objects created? These objects
are not initialized until the function is called, but is storage
allocated for them even if they are never called?
4)For a function, where are const type objects created? on the stack as
well?
5)For a class, where are static class member objects created?
Thanks.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.m oderated. First time posters: Do this! ]
I have a question regarding storage locations for different data types.
For example, dynamically created objects (using "new") are created on
the heap. local objects ( foo() {int x;} ) are on the stack.
1)Where are global non-const objects created?
2)Where are global const objects created?
3)For a function, where are local static objects created? These objects
are not initialized until the function is called, but is storage
allocated for them even if they are never called?
4)For a function, where are const type objects created? on the stack as
well?
5)For a class, where are static class member objects created?
Thanks.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.m oderated. First time posters: Do this! ]
Comment