更新时间:2023-12-04 11:27:28
这不是在许多方面的安全。首先,如果任何变量称为T已经存在,它不会编译。
It is not safe in many ways. First, if any variable called t already existed, it wouldn't compile.
除此之外,你必须要小心这样的话:
Apart from that, you have to be careful with things like:
if (...)
swap(a,b);
如将它扩展为:
if (...)
int t;
do { ... } while(0);
注意,因为如果没有括号的,如果块主体将只是一个声明。
Note that the if body would be only a declaration because there are no braces for the if block.
你为什么不声明T内的做阻止?
Why don't you declare t inside the do block?