Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

`const`-as-comment is specifically limited to pointers and references - `const` on objects definitely does change semantics (it is always UB to attempt to modify a `const` object).

Another good example is string literals (except when initializing a non-const `char[]` variable), which are often allocated in read-only data in the same way, since they are const objects too.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: