2 ms·
Regarding c++, const foo * is the same type as foo const * . For consistency, one should postfix the const to the thing you want to be immutable, so foo const
by sbmassey 12y ago
Regarding c++, const foo * is the same type as foo const * .
For consistency, one should postfix the const to the thing you want to be immutable, so foo const * is a pointer to an immutable foo, foo * const is an immutable pointer to a mutable foo, and foo const * const is an immutable pointer to an immutable foo. It works pretty well, as far as I can see.
- blahedo 12y agoArgh, yes, you're exactly right, and now I'm too late to edit my post. I hate it when I get that backwards; sorry about that.