const가 붙은 대상을 읽는다
별표 왼쪽의 const는 pointee, 별표 오른쪽의 const는 pointer 변수 자체에 붙는다.
const int*와 int* const는 비슷해 보이지만 잠그는 대상이 다르다. 왼쪽 값을 못 바꾸는지, 포인터 자체를 못 옮기는지 읽어야 한다.
별표 왼쪽의 const는 pointee, 별표 오른쪽의 const는 pointer 변수 자체에 붙는다.
함수가 값을 읽기만 한다면 const T* 또는 const T&로 호출자 객체를 보호한다.
const pointer도 자원을 소유한다는 뜻은 아니다. 삭제 책임은 다른 타입으로 표현한다.
const int* readOnly = &value;
int* const fixedAddress = &value;
const int* const fixedReadOnly = &value;