由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - a small question about c++ object allocation
相关主题
A problem about Heap and Stack.问几道老题
请教个C++编程思路A malloc/free question using C/C++
问个static的问题 (转载)在子函数内开内存,返回主函数指针然后释放空间是不是很糟糕的(转载)
heap 和 stock都有些啥区别啊?问两道以前的Bloomberg题
c++ grill - how to dynamically allocate memory on stack?topercode DP问题求解
C++ Q78: about sizeof请教一道题
Char x[] = "abc"; 是在heap还是stack上? (转载)明天要面 facebook 的 PhD team allocation interview, 求知情人指导
为什么C++的constructor出错可以抛出异常,而destructor出错问道G题(2)
相关话题的讨论汇总
话题: static话题: a1话题: stack话题: class话题: allocation
进入JobHunting版参与讨论
1 (共1页)
S**Y
发帖数: 136
1
I have a class A with a public static member
class A{
...
public:
static int i;
private
int j,k;
char* s;
....
}
in the main program, I have
A a1;
I understand that a1 will be in stack, a1's j, k will be in stack too; s wil
l point to a dynamically allocated heap(if new-ed).
but how about the static variable i? It belongs to class A. Will it be in th
e data section?
Thanks a lot.
a**********s
发帖数: 588
2
Yes, it will be in the data segment, not in the stack.
S**Y
发帖数: 136
3
thanks.

【在 a**********s 的大作中提到】
: Yes, it will be in the data segment, not in the stack.
1 (共1页)
进入JobHunting版参与讨论
相关主题
问道G题(2)c++ grill - how to dynamically allocate memory on stack?
定义一个数组, 巨简单的一个问题C++ Q78: about sizeof
有没有人同觉得Recover Binary Search Tree的solution using O(n) space并不是那么straight forward么?Char x[] = "abc"; 是在heap还是stack上? (转载)
L的team match为什么C++的constructor出错可以抛出异常,而destructor出错
A problem about Heap and Stack.问几道老题
请教个C++编程思路A malloc/free question using C/C++
问个static的问题 (转载)在子函数内开内存,返回主函数指针然后释放空间是不是很糟糕的(转载)
heap 和 stock都有些啥区别啊?问两道以前的Bloomberg题
相关话题的讨论汇总
话题: static话题: a1话题: stack话题: class话题: allocation