NYC's Blog - Top-Level和Low-Level const 的评论
关于const,之前已经在多篇博客里面有介绍过了。我们知道const本身的含义很简单,就是被它修饰的对象不可以改变。但是,当他和指针或是引用一起使用的时候,我们往往比较难区分到底是指针(或引用)...
2021-03-22T09:13:59+08:00
Typecho
http://niyanchun.com/feed/atom/top-level-and-low-level-const.html
http://niyanchun.com/top-level-and-low-level-const.html/comment-page-1#comment-673
2021-03-22T09:13:59+08:00
2021-03-22T09:13:59+08:00
NYC
https://niyanchun.com
感谢指正,已修正!?
]]>
http://niyanchun.com/top-level-and-low-level-const.html/comment-page-1#comment-672
2021-03-22T09:10:04+08:00
2021-03-22T09:10:04+08:00
NYC
https://niyanchun.com
是的,笔误,已修正?
]]>
http://niyanchun.com/top-level-and-low-level-const.html/comment-page-1#comment-671
2021-03-20T19:06:41+08:00
2021-03-20T19:06:41+08:00
tina
第二个代码块的第6行,引用是low-level的
]]>
http://niyanchun.com/top-level-and-low-level-const.html/comment-page-1#comment-449
2018-04-02T10:07:48+08:00
2018-04-02T10:07:48+08:00
慕斯唐
const int *const p3 = p2; // 最右边的const是top-level的,即p3指向的对象是const的;最左边的const是low-level的,即p3本身的值不可变
这句话不对,最右边的const是top-level,即p3本身是不可变的,不能胡乱忘别的地方指;最左边的const是low-level,即p3指向的那个对象不能改变
]]>