# 常量叠算(Constant folding),还是叫常量合并更合适点，呵呵

const int c=111;
int& r=const_cast<int&>(c);
int* p=const_cast<int*>(&c);
cout<<"const [<<&c<<"]"<<c<<endl;
cout<<"refer [<<&r<<"]"<<r<<endl;
cout<<"point [<<p<<"]"<<*p<<endl;
r=222;

cout<<"after:"<<endl;
cout<<"const [<<&c<<"]"<<c<<endl;
cout<<"refer [<<&r<<"]"<<r<<endl;
cout<<"point [<<p<<"]"<<*p<<endl;

答案如下：

const [0xbfff5614]111
refer [0xbfff5614]111
point [0xbfff5614]111
after:
const [0xbfff5614]111
refer [0xbfff5614]222
point [0xbfff5614]222

const int c=111;
int& r=const_cast<int&>(c);

cout<<"const [<<&c<<"]"<<111<<endl;
cout<<"refer [<<&r<<"]"<<r<<endl;
cout<<"point [<<p<<"]"<<*p<<endl;
r=222;
cout<<"after:"<<endl;
cout<<"const [<<&c<<"]"<<111<<endl;
cout<<"refer [<<&r<<"]"<<r<<endl;
cout<<"point [<<p<<"]"<<*p<<endl;

for(int   i=0;i<100*200*300;i++){
......
}

#### 纸张对折计算

2018-01-31 12:50:26

#### 【Algorithm】 重叠部分面积计算

2017-09-07 16:34:48

#### mesh简化实现——边折<em>叠算</em>法

2018年05月09日 00:00

#### margin的折叠与计算以及解决之道

2016-09-01 11:24:32

#### 颜色叠加算法

2016-09-24 15:52:06

#### 两个半透明颜色色的叠加计算方法

2017-12-15 17:50:19

#### Photoshop图层混合模式的计算公式

2017-01-04 09:27:39

#### JAVA实现简单的计算器

2018-06-06 23:57:29

#### 常量折叠 Constant folding

2013-10-06 20:32:16

#### Java常量放在Class还是Interface?

2017-02-06 18:45:58