wine习得知识小记
2020-11-28 14:13
标签:des style c color a int 1、 VS2008: 这样就很明显了,为了支持大的stream而故意引入streamsize的改变。 2、 以前初学C\C++用pow函数的时候也有点疑惑, Let‘s count the ways the hypthetical int pow_int(int, int) function could fail.
3、 花括号其实是为了定义变量…… wine习得知识小记,搜素材,soscw.com wine习得知识小记 标签:des style c color a int 原文地址:http://blog.csdn.net/christopherwu/article/details/26166357
sizeof cin:60
sizeof streamsize: 4
VS2012
sizeof cout:80
sizeof cin:96
sizeof streamsize: 8
Overflow
Result undefined pow_int(0,0)
Result can‘t be represented pow_int(2,-1)
The function has at least 2 failure modes. Integers can‘t represent these values, the behaviour of the function in these cases would need to be defined by the standard - and programmers would need to be aware of how exactly the function handles these cases.
加上了花括号的话,里面的变量只在这个花括号里有用。
case 1:{int a;break;}
case 2:{int a;break;}
否则就得
case 1:int a;break;
case 2:int b;break;
值得注意的是,C85 里是不允许在任意地方定义变量的,必须放在一个复合语句的起始部分。