不要C99式沃拉斯有什么样的技术缺点? [英] What technical disadvantages do C99-style VLAs have?

查看:121
本文介绍了不要C99式沃拉斯有什么样的技术缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从很多人听说可变长度数组,在C99推出,是可怕的。在IRC上有些人说,一分钟前我不认为C ++会得到VLA的,strousoup作了关于他们一些非常负面评论»。

I heard from many people that variable length array, introduced in C99, are terrible. Some guys on IRC said a minute ago « I don't think C++ will get VLA's, strousoup made some very negative comments about them ».

什么是为什么这些人讨厌沃拉斯的原因?

What are the reasons why those people hate VLAs?

推荐答案

在沃拉斯栈上分配的阵列,在运行系统中,使其更难,甚至无法确定在编译时使用的堆栈大小。由于栈有(与堆比较)的可用内存相当少量的,很多人担心沃拉斯有堆栈溢出的巨大潜力。

VLAs allocate arrays on the stack, in runtime, making it harder, or even impossible to determine the stack size used at compile time. Since the stack has a rather small amount of memory available (in comparison with the heap), many worry that VLAs have a great potential for stack overflow.

在MISRA-C编码标准的即将推出的版本是最有可能会禁止沃拉斯为好。

The upcoming version of the MISRA-C coding standard is most likely going to ban VLAs as well.

这篇关于不要C99式沃拉斯有什么样的技术缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆