4 ms·
C++ doesn't have to be complicated. It involves such a compoundingly convoluted tool box however that you can create overly complicated contraptions that can ex
by gregsq 14y ago
C++ doesn't have to be complicated. It involves such a compoundingly convoluted tool box however that you can create overly complicated contraptions that can explode right in front of you.
There was one fundamental decision made back in the day about the copy constructor, where it takes a const reference as its single argument, that removed logically the C pointer problem. It's still possible to reintroduce it, but it helped prove correctness. In other words you can't make something unless the compiler knows that it's made something. Using an address the compiler has to take your word for it. You can think more contractually, as in say Eiffel, where if there is garbage in its not the programmers doing by definition. At its best it cures some C gotchas. At its worst it can be contrived and misapplied.
But as I say, you can break it any which way.