T240516 Top-level const and Low-level const
本篇分享详细解释一下 Top-level const 和 Low-level const 的概念。 Top-level 和 Low-level 指的是名称修饰符所处的位置,const 是最常见的修饰符,举一反三,便可知所有情况。 由例子切入理解: int a = 42; int b = 10; int* const p1 = &a; // top-level const *p1 = 22; // Ok p1 = &b; // Error! int const* p2 = &a; // low-level const *p2 = 22;… Continue Reading T240516 Top-level const and Low-level const