3 ms·
No, but you can have that with pointers, since the constness of the pointer itself (i.e., whether you can change the address) is separate from the object it poi
by to3m 11y ago
No, but you can have that with pointers, since the constness of the pointer itself (i.e., whether you can change the address) is separate from the object it points to (i.e., whether it might point into ROM or not). So you can have T * (variable RAM address), T * const (fixed RAM address), const T * (variable ROM/RAM address), and const T * const (fixed ROM/RAM address).
(References, by contrast, can never be reseated. So const T &const doesn't make sense. But... I didn't try this right now to double check, so if it works - though I think it doesn't - don't blame me. Or, if you do, at least allow me to plead extenuating circumstances, in the form of C++.)
- angersock 11y agoThat seems right, I must've swapped that behavior with that of pointers in my head.