由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - c++ grill - how to dynamically allocate memory on stack?
相关主题
Char x[] = "abc"; 是在heap还是stack上? (转载)heap 和 stock都有些啥区别啊?
问个C++题贡献几个 c 电面问题
C++ Q78: about sizeof凌晨的飞机,第一个travel的onsite
A problem about Heap and Stack.Two C++ questions from Bloomberg on-site
a small question about c++ object allocationC++ Q33: typedef (B4_20)
请教个C++编程思路C++ Q48: illegal operation (C33)
为什么C++的constructor出错可以抛出异常,而destructor出错C++ Q66: reverse a string -- is it efficient
A malloc/free question using C/C++Two classic C++ question, how to answer
相关话题的讨论汇总
话题: stack话题: memory话题: allocate话题: grill
进入JobHunting版参与讨论
1 (共1页)
l********y
发帖数: 1327
1
someone said stack memory can also be dynamically allocated. yes stack the
stack memory,not heap.
is this possible? and how?
l*****g
发帖数: 685
2
comfort, 看来你碰到了一个爱考茴香的茴有几种写法的孔乙己式牛人
有个alloca function, 可以用来在dynamically allocate memory in stack. 但是这
个function,
不是C++ standard, 不是所有compiler都support, 而且只能allocate很少量memory,
否则很容易
causes stack overflow.
总之, 用alloca不是good practice. 需要用alloca的case, 都可以用一个fixed or
dynamic array来解决

【在 l********y 的大作中提到】
: someone said stack memory can also be dynamically allocated. yes stack the
: stack memory,not heap.
: is this possible? and how?

1 (共1页)
进入JobHunting版参与讨论
相关主题
Two classic C++ question, how to answera small question about c++ object allocation
Bloomberg面经+个人找工作小感请教个C++编程思路
Goldman Sachs IT Position at Jersey City, New Jersey (转载)为什么C++的constructor出错可以抛出异常,而destructor出错
问一个C的简单问题A malloc/free question using C/C++
Char x[] = "abc"; 是在heap还是stack上? (转载)heap 和 stock都有些啥区别啊?
问个C++题贡献几个 c 电面问题
C++ Q78: about sizeof凌晨的飞机,第一个travel的onsite
A problem about Heap and Stack.Two C++ questions from Bloomberg on-site
相关话题的讨论汇总
话题: stack话题: memory话题: allocate话题: grill