在
Wikipedia我发现这个:
A a( A() );
[This] could be disambiguated either as
a variable definition of class [
A
],taking an anonymous instance of class [A
] ora function declaration for a function which returns an object of type [
A
] and takes a single (unnamed) argument which is a function returning type [A
] (and taking no input).Most programmers expect the first,but the C++ standard requires it to be interpreted as the second.
但为什么?如果大多数C社区期望以前的行为,为什么不使其成为标准?此外,如果您不考虑解析模糊性,上述语法是一致的.
有人可以启发我吗?为什么标准使之成为一项要求?