On May 28, 9:41?am, James Kanze <james.ka...@gmail.com> wrote:
On May 27, 10:30 pm, Michael Doubez <michael.dou...@free.fr> wrote:
In sum: objects of array type are never const, but never
modifiable. ?(The same doesn't apply to elements of the array,
of course. ?The elements may be const or not, and if they are
not const, they can be modified.)
Ideally in designing a programming language IMO any object that isnt
qualified should be const by default so if you want a mutable object
you have to do extra work. This is i think the practise in functional
languages. If I review my code there are a very large proportion of
cases where objects are never modified after they have been
initialised, but it is tedious in C++ to add the const modifier
everywhere though doing so greatly helps to understand the big picture
of what the code is doing. however ideally non-constness should be
what jumps out rather than constness.