'default'作为变量名 [英] 'default' as a variable name
本文介绍了'default'作为变量名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在调试一些代码时,我遇到了一个名为 default
的数组。我认为关键字不允许作为变量名。
While debugging some code, I came across an array named default
. I thought that keywords were not allowed as variable names.
#include "stdafx.h"
#include <stdio.h>
int main()
{
int default = 5;
printf("%d\n", default);
return 0;
}
现在上面的代码在VS 2008上没有问题。默认'a关键字?它如何作为一个变量名?副作用?
Now the above code compiles without a hitch on VS 2008. Isn't 'default' a keyword? How come it works as a variable name? Side-effects?
PS: Infragistics :: Win :: UltraWinToolbars :: ToolbarsCollection
具有此名称的属性!
PS: Infragistics::Win::UltraWinToolbars::ToolbarsCollection
has a property with this name!
推荐答案
这是一个已知问题。基本上是为C ++ / CLI兼容性而设计的。
It's a known issue in VC++. Basically by-design for C++/CLI compatibility.
这篇关于'default'作为变量名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文