由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - static variable存在heap还是stack?
相关主题
static 变量放在哪里?C++static vector 怎么 initialize ?
再问C++初始化问题。 error LNK2001:的错误如何改正?
为什么会有recursion stack overflow这个问题?请教什么时候变量会被load进stack,什么时候进入heap呢?
stack/heap corruption请问static variable init的问题?
What're the three types of memory allocated for C++ variables?vector< vector > > 怎么初始化?
请问一个关于 cost of pointer的问题another c++ interview question
关于C/C++里的Static variable的memory allocation/initializa一个基本问题:stack vs heap
a small question about c++ memory allocationhow much slower: heap vs stack memory allocation?
相关话题的讨论汇总
话题: heap话题: stack话题: static话题: variable话题: segment
进入Programming版参与讨论
1 (共1页)
l*******p
发帖数: 7
1
语言:c++
网上查了一下,有的说是heap,有的说机不再heap也不再stack
请问到底再哪里?
先谢了
q*****g
发帖数: 72
2
既不在heap,也不在stack, 在global name space里

【在 l*******p 的大作中提到】
: 语言:c++
: 网上查了一下,有的说是heap,有的说机不再heap也不再stack
: 请问到底再哪里?
: 先谢了

t**m
发帖数: 263
3
not stack
kind of globle heap

【在 l*******p 的大作中提到】
: 语言:c++
: 网上查了一下,有的说是heap,有的说机不再heap也不再stack
: 请问到底再哪里?
: 先谢了

D*******a
发帖数: 3688
4
在bss里面

【在 l*******p 的大作中提到】
: 语言:c++
: 网上查了一下,有的说是heap,有的说机不再heap也不再stack
: 请问到底再哪里?
: 先谢了

t*******l
发帖数: 3662
5
really? who says "heap" and who says "stack".
the language itself does not specify any data segment for the static
variable as long as the behavior is correct.
in practice, many systems will put static variables into
the data segment (if initialized)
or the bss segment (if uninitialized).

【在 l*******p 的大作中提到】
: 语言:c++
: 网上查了一下,有的说是heap,有的说机不再heap也不再stack
: 请问到底再哪里?
: 先谢了

b*****n
发帖数: 2324
6
wherever it's placed, its address is fixed.

【在 l*******p 的大作中提到】
: 语言:c++
: 网上查了一下,有的说是heap,有的说机不再heap也不再stack
: 请问到底再哪里?
: 先谢了

b****p
发帖数: 13
7
不一定吧。如果初始化了,就不在bss,应该在data段吧。

【在 D*******a 的大作中提到】
: 在bss里面
j********g
发帖数: 88
8
it is not dynamic memory allocation. So dynamic memory allocation methods
are not applicapable.
1 (共1页)
进入Programming版参与讨论
相关主题
how much slower: heap vs stack memory allocation?What're the three types of memory allocated for C++ variables?
c 里面的local static variable请问一个关于 cost of pointer的问题
问一个private destructor的问题关于C/C++里的Static variable的memory allocation/initializa
[合集] 谁给个stack-based allocation 的C++的例子?a small question about c++ memory allocation
static 变量放在哪里?C++static vector 怎么 initialize ?
再问C++初始化问题。 error LNK2001:的错误如何改正?
为什么会有recursion stack overflow这个问题?请教什么时候变量会被load进stack,什么时候进入heap呢?
stack/heap corruption请问static variable init的问题?
相关话题的讨论汇总
话题: heap话题: stack话题: static话题: variable话题: segment