if you can show where is the problem with few line of easy code here
ok
I think that's sort of the point: This is a code maintenance issue, which
means it tends to become significant only when you get to larger projects.
I don't think this matters.
who is careful? are you? are the one that propose const?
I definitely didn't propose it, and I sort of dislike it. But I use it
now because I've learned that it results in the compiler catching things
that I didn't think through carefully enough, or where I'd simply forgotten
things.
The basic issue: Some functions which take a pointer want to modify
the thing pointed to. Some don't. Sometimes, I have a thing which I wouldn't
mind having the code modify, sometimes, I really don't want it modifying
the thing. If I don't have a 100% perfect memory of which functions are
which, I am likely to occasionally pass a pointer to data I don't want
modified into a function which will modify data.
If I use const qualifiers consistently, that gets me an error at compile
time which allows me to evaluate it and determine what I forgot this time.
Usually, it turns out that indeed it is the case that I forgot about
a side-effect, or forgot that a given object needed to be not-modified by
my code. And that means that const has caught something that would otherwise
have been a very mysterious and possibly sporadic failure at runtime.
-s