作者ric2k1 (Ric)
看板EE_DSnP
标题[更正] const int *& q 的问题
时间Wed Mar 12 18:02:05 2008
上课时讲到的例子:
int a = 10;
int *p = &a;
const int *& q = p;
....
....
事实上 compile 不会过!!
因为 "int*" 与 "const int*" 不同, 不能当作彼此的 reference.
---
"refernce" 是 compile time 决定的东西.
"reference" type variable 并不会占用记忆体位置, compiler 在 compile time
就会用 symbol table 把它 resolve 掉了!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.21.241