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?
|
|