Re: Variables in for loop (style issue)
David Abrahams wrote:
Walter Bright <walter@digitalmars-nospamm.com> writes:
1) Once you start using const, for example, you wind up being
forced to
propagate const throughout. It has a sort of viral effect
making it
difficult to ease into writing const-correct code.
A false problem. It's just like strong typing. Imagine a language
with fully dynamic typing and optional static type checking. "Once
you start using static type checking, you wind up being forced to
propagate type declarations throughout. It has a sort of viral effect
making it difficult to ease into writing typesafe code."
Yes, I agree it's just like optional strong typing - I can imagine what
a pain that would be. It's probably why there aren't such languages.
C++ does not have optional strong typing. It's required. One can write
complete, correct, and working programs in a strongly typed language
while ignoring const. To start adding in const, however, requires it to
be added throughout the program. No way to ease into it.
One can ease into C++ features like OOP, // comments, STL, etc. But not
const-correctness.
-Walter Bright
www.digitalmars.com C, C++, D programming language compilers
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]