From: Jorgen Grahn on
["Followup-To:" header set to comp.lang.c++. Neither the Java nor the
comp.programming people want to read about const correctness, I'm sure.]

On Tue, 2010-07-20, Alexander wrote:
> Wherever I find something on the topic, these are considered positive.

Only these two, or do you include a number of other things under
"etc", unknown to us?

> Why? I only find it time-consuming. Could you respond (preferably on
> comp.programming) why it can be considered as such, but motivated,
> that is without responses like "it's good software engineering
> practice", "it's just better", etc...

Const specifically: a language feature I really like.

I guess you can say that it adds another dimension to the type system.
It's good for the same reasons that the rest of the static typing is
good. E.g. that we can have have Foo* and Bar*, not just void*.

You make more information about your intentions explicit, in the code,
for the benefit for the reader. And the compiler can check it.

> I'm a learner, and I think now
> is the best time to shape out practices and priorities.

Yes. For const, you don't really have a choice -- if you refuse to use
it, you'll be in constant conflict with other programmers working on
the code.

There are still, I think, old C programmers who reject const, but I
never heard of a C++ programmer who did.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .