| "If you write code in the STL weenie style or the Pretend It's Java style there aren't any idioms I know of that would ever violate the rules he mentions (out-of-range pointers, signed overflow, invalid aliasing)." What does the STL do about signed overflow? As for out of range pointers, that is an easy one to get with the STL: vector<int> somevector(100);
somevector[200] = 5;
"These are not problems of a language per se"Yes they are: the default numeric type is fixed-width, pointers pop up all over the place and pointer dereferences are unchecked by default. Personally, though, I would have chosen (as the article's author did) the more severe deficiencies in the standard, like the lack of any requirement that a function with a non-void return type have a return statement along every control path or the fact that there is no reliable way to signal errors that occur in destructors. "These low-level bit banging errors are vastly less common" Not in my experience, and not judging by the number of bug reports and vulnerabilities I have seen that stem from low-level mechanics. |
this:
Is a C idiom translated by cut-and-paste. The unmotivated poking of arbitrary magic-number offsets into a magic-number sized vector is not proper. It's the kind of thing that sets off alarm bells on even the most casual of review.