为什么不自动? [英] Why not auto?
问题描述
你好,
与寄存器不同,auto关键字不能用于
声明形式参数。有没有具体的
原因?
亲切的问候,
Vijay Kumar R. Zanvar
" Vijay Kumar R. Zanvar" < 6 ***** @ gmail.com>写道:
与寄存器不同,auto关键字不能用于声明形式参数。是否有任何具体的原因?
除寄存器外,没有任何存储类说明符可用于函数
参数声明。不是自动的,但不是静态的,extern或typedef
。我想,原因是将函数参数声明为
是extern或auto比宣布注册更有意义。
考虑:无论它意味着什么,a静态函数参数?
Richard
Richard Bos写道:Vijay Kumar R. Zanvar < 6 ***** @ gmail.com>写道:
与寄存器不同,auto关键字不能用于声明形式参数。是否有任何具体的原因?
除寄存器外,没有任何存储类说明符可用于函数
参数声明。不是自动的,但不是静态的,extern或typedef
。我想,原因是将函数参数
声明为extern或auto比声明注册更有意义。
考虑:无论它意味着什么,a静态函数参数?
Richard
但是在一个上下文中,允许在函数中使用static
参数。
Vijay
" Vijay Kumar R. Zanvar" < 6 ***** @ gmail.com>在消息中写道
news:11 ********************** @ o13g2000cwo.googlegr oups.com ...您好,
与register不同,auto关键字不能用于声明形式参数。是否有任何具体的原因?
功能参数已经有效''自动''
(它们消失了)当函数退出时)。什么属性
你觉得''自动'资格会给一个函数
参数吗?
-Mike
Hello,
Unlike register, auto keyword can not be used to
declare formal parameter(s). Is there any specific
reason for this?
Kind regards,
Vijay Kumar R. Zanvar
"Vijay Kumar R. Zanvar" <vi*****@gmail.com> wrote:
Unlike register, auto keyword can not be used to
declare formal parameter(s). Is there any specific
reason for this?
No storage class specifier except register can be used for function
parameters declarations. Not auto, but not static, extern or typedef
either. The reason, I suppose, is that declaring a function parameter to
be extern or auto makes even less sense than declaring it register.
Consider: whatever would it mean, a static function parameter?
Richard
Richard Bos wrote:"Vijay Kumar R. Zanvar" <vi*****@gmail.com> wrote:Unlike register, auto keyword can not be used to
declare formal parameter(s). Is there any specific
reason for this?
No storage class specifier except register can be used for function
parameters declarations. Not auto, but not static, extern or typedef
either. The reason, I suppose, is that declaring a function parameter
to be extern or auto makes even less sense than declaring it register.
Consider: whatever would it mean, a static function parameter?
Richard
But in one context, static is allowed to be used in function
parameters.
Vijay
"Vijay Kumar R. Zanvar" <vi*****@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...Hello,
Unlike register, auto keyword can not be used to
declare formal parameter(s). Is there any specific
reason for this?
Function parameters are already effectively ''auto''
(they go away when the function exits). What property
do you feel an ''auto'' qualification would give a function
parameter?
-Mike
这篇关于为什么不自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!