Fully transitive const is not necessary
Walter Bright
newshound1 at digitalmars.com
Wed Apr 2 11:51:58 PDT 2008
Sean Kelly wrote:
> I agree that transitive const can achieve more demonstrably correct code
> but I don't think it follows that this will necessarily improve productivity.
> My experience with const in C++ is that it actually reduces productivity
> because I spend more time dealing with the misapplication of const than
> I gain from whatever bugs the application of const may have prevented.
> In fact, in all my time as a programmer I can't think of a single instance
> where I've encountered a bug that could have been prevented through
> the use of const.
C++ const is more of a suggestion than anything verifiable by the
compiler and static analysis. This will become more obvious as C++ tries
to compete in the multiprogramming arena. The C++ compiler *cannot* help
with multiprogramming issues; the C++ programmer is entirely dependent
on visual inspection of the code, making C++ a tedious, labor intensive
language for multiprogramming.
How many times have you looked at the documentation for a function API,
and wondered which of its parameters were input and which were output?
When you talk about the "misapplication" of const, does that mean
failure to understand what the specific API of a function is?
More information about the Digitalmars-d
mailing list