2 ms·
That would be const type pointer. (HN apparently won't let me type more than one asterisk in the message without turning everything between them to italics.)
by nostrademons 16y ago
That would be const type pointer. (HN apparently won't let me type more than one asterisk in the message without turning everything between them to italics.) const type pointer const is a const pointer to a const object, i.e. the pointer itself can't be mutated to point to a different object.
I've never found a need for it. I usually don't care if the pointer itself is modified, particularly since such modifications are usually local and obvious.
- mansr 16y agoIt is useful for static (possibly global) data which if const can be placed in the read-only data section. For local variables or function parameters it is less useful.