本文介绍了gcc和alloca的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里的一些人已经开始说'alloca'

不在话题,他们使用了gcc

编译器无法识别它的论点。


他们使用-ansi选项编译他们的代码,并且

(当然)恰当地命名为pedantic。选项。


我与gcc

编译器的开发人员无关,但是看到了他们实现的事实

我无法想象,如果他们不想使用

的人使用它,他们会努力制作

a BUILT-IN(__builtin)功能。


*默认*设置中的gcc编译器支持alloca

甚至比lcc-win32更好,因为它们使它成为内置的。


这个年纪以来!


PS

在windows下,你必须做一个小的汇编程序循环

来触摸当你走下堆栈时分配的页面。

这会导致轻微的代码膨胀,我更喜欢

函数调用方法。

Some people here have started saying that "alloca"
is off topic, and they used the argument that the gcc
compiler doesn''t recognize it.

They compile their code using the -ansi option, and
(off course) the aptly named "pedantic" option.

I am not related in anyway to the developers of the gcc
compiler but seeing the facts of their implementation
I can''t imagine that they would take the effort of making
a BUILT-IN (__builtin) function if they did not want
people to use it.

The gcc compiler in its *default* setting supports alloca
even better than lcc-win32 since they made it a builtin.

And this since ages!

P.S.
Under windows, you have to make a small assembler loop
to touch the allocated pages as you walk down the stack.
This would lead to a slight code bloat and I prefered
the function call method.

推荐答案




alloca()不在标准中。因此它是偏离主题的。

-

如有疑问,请将特色作为贬义。

(想想一把百刀的瑞士军刀。)

--Kernighan和Plauger,_Software Tools_



alloca() is not in the Standard. Therefore it is off-topic.
--
"When in doubt, treat ``feature'''' as a pejorative.
(Think of a hundred-bladed Swiss army knife.)"
--Kernighan and Plauger, _Software Tools_





不要使用alloca。它已经过时了。

使用可变长度数组和-std = c99选项。



Don''t use alloca. It is obsolete.
Use "variable length arrays" and the -std=c99 option.





ERT是正确的。 (由于我不想进入的原因,这值得指出

out。)


-

Keith Thompson (The_Other_Keith)< http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。



ERT is correct. (For reasons I won''t go into, this is worth pointing
out.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


这篇关于gcc和alloca的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 01:43