|
Janin posted:Oh good, so all I have to do to make reference code safe is...treat every reference as a magical pointer? If the people who worked on the code before you couldn't understand the semantics of references (which is scary enough by itself), I can hardly see how that's the language's fault any more than it would be Java's fault if a programmer couldn't understand the "reference by value" passing that has already been discussed ad nauseum (and I've seen several people who've struggled with exactly that. They were programming 101 students, though). If you violate a function's preconditions or an invariant of the language itself, your program is in an inconsistent state by definition. Allowing a null reference to be passed is no more a design flaw of C++ than allowing NULL to be passed to strlen is a design flaw of C. They're both precondition violations and will most likely have the same outcome.
|
# ¿ Mar 17, 2009 06:37 |
|
|
# ¿ Apr 24, 2024 05:07 |
|
PHP 5.3: now with goto
|
# ¿ Jul 2, 2009 00:58 |