Exceptions Considered Harmful or: throw is just goto in drag

The two pillars of modern software design are objects and exceptions. Objects allow us to partition very large systems into smaller, comprehensible chunks, and exceptions keep them running smoothly, by protecting them against malfunctions.

Funny thing is: though modern software is huge in comparison to the old-fashioned variety, it doesn’t seem any more reliable. Even though everybody knows that exceptions make programs better, I’ve never yet seen any real evidence that shows any reason even to suspect that it’s true. In point of fact, I don’t believe it, and I rather suspect that in most cases, exceptions make matters worse. Continue reading

Bare-metal arrays made safe: a simple protected-pointer template for C++

One of the reasons why C++ is still the professionals’ language is because of its flexibility.  You can use STL collections, and they’ll work as automatically and as safely as anything in Java or C#. Or you can use naked  pointers into unprotected memory, and it will be as fast as old-style C, but just as dangerous.  But, between these two extremes, there’s a need for something as fast and efficient as real memory, but safe – as safe as Pascal.  And that’s a different animal from either.

Continue reading