hal*_*lex 6 c typedef strong-typing
typedefs不强类型的原因是什么?有什么好处我看不到,还是由于向后兼容?看这个例子:
typedef int Velocity;
void foo(Velocity v) {
//do anything;
}
int main() {
int i=4;
foo(i); //Should result in compile error if strongly typed.
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我不是要求变通方法来获得强类型数据类型,而只是想知道为什么标准不需要typedefs强类型化?
谢谢.
| 归档时间: |
|
| 查看次数: |
571 次 |
| 最近记录: |