gpt4 book ai didi

c++ - 谁能解释一下当前C++0x标准草案的这一段?

转载 作者:行者123 更新时间:2023-11-30 02:09:12 26 4
gpt4 key购买 nike

谁能解释 ISO N3242 §3.3.3 第 2 点中的这个陈述

The potential scope of a function parameter name (including one appearing in lambda-declarator) or of a function-local predefined variable in a function definition (8.4) begins at its point of declaration. If the function has a function-try-block the potential scope of a parameter or of a function-local predefined variable ends at the end of the last associated handler, otherwise it ends at the end of the outermost block of the function definition. A parameter name shall not be redeclared in the outermost block of the function definition nor in the outermost block of any handler associated with a function-try-block.

ISO 标准 2003 说:

The potential scope of a function parameter name in a function definition (8.4) begins at its point of declaration. If the function has a function-try-block the potential scope of a parameter ends at the end of the last associated handler, else it ends at the end of the outermost block of the function definition. A parameter name shall not be redeclared in the outermost block of the function definition nor in the outermost block of any handler associated with a function-try-block.

这些陈述的实际区别是什么?

有人用示例/程序来解释上面添加的点吗?

我注意到它属于函数局部预定义变量他实际上在说什么..关于这个?

最佳答案

变化是添加了“函数局部预定义变量”,这是 C++0x 的新增功能。它们是可在函数内使用的隐式定义的静态变量。标准草案定义了一个名为 __func__ 的函数,它给出了函数的名称,并允许实现添加更多自己的函数。这一段现在说它们在函数参数名称所在的任何地方都可用。

关于c++ - 谁能解释一下当前C++0x标准草案的这一段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5677097/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com