问题描述
我知道嵌套函数不是标准C的一部分,但因为他们是在海湾合作委员会present(而事实上,GCC是我关心的只是编译器),我倾向于经常使用它们。
I know that nested functions are not part of the standard C, but since they're present in gcc (and the fact that gcc is the only compiler i care about), i tend to use them quite often.
这是一件坏事?如果是这样,你能告诉我一些讨厌的例子吗?
什么是在GCC嵌套函数的状态?他们是否会被删除?
Is this a bad thing ? If so, could you show me some nasty examples ? What's the status of nested functions in gcc ? Are they going to be removed ?
感谢
推荐答案
嵌套函数真的没有做任何事情,你不能用非嵌套的人做的(这就是为什么既不是C和C ++为他们提供)。你说你不感兴趣的其他编译器 - 也可能在这一刻是atrue,但谁知道将来会带来什么?我会避开他们,与所有其他海湾合作委员会增强沿。
Nested functions really don't do anything that you can't do with non-nested ones (which is why neither C nor C++ provide them). You say you are not interested in other compilers - well this may be atrue at this moment, but who knows what the future will bring? I would avoid them, along with all other GCC "enhancements".
一个小故事来说明这一点 - 我用来为英国Polytechinc它主要用于DEC箱的工作 - 特别是在DEC-10和一些VAXen。所有工程学院使用的许多DEC扩展其code与Fortran - 他们确信我们仍然是一个DEC店永远。然后,我们与IBM大型机,谁的FORTRAN编译器不支持任何扩展取代了DEC-10。有很多哭,并在这一天咬牙切齿,我可以告诉你。我自己的FORTRAN code(8080仿真器)移植到了IBM在几个小时(几乎全部用在了学习驾驶IBM的编译器),因为我在写它的沼泽标准FORTRAN-77。
A small story to illustrate this - I used to work for a UK Polytechinc which mostly used DEC boxes - specifically a DEC-10 and some VAXen. All the engineering faculty used the many DEC extensions to FORTRAN in their code - they were certain that we would remain a DEC shop forever. And then we replaced the DEC-10 with an IBM mainframe, who's FORTRAN compiler didn't support any of the extensions. There was much wailing and gnashing of teeth on that day, I can tell you. My own FORTRAN code (an 8080 simulator) ported over to the IBM in a couple of hours (almost all taken up with learning how to drive the IBM compiler), because I had written it in bog-standard FORTRAN-77.
这篇关于是嵌套函数在GCC坏事?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!