No Boost for Google

I recently came across the Google C++ Style Guide, and since the folks at Google are geniuses, I thought it would be worth a read. Among the various sound practices, sage advice, and sensible conventions which it laid out, I found this surprising requirement:

» Continue reading…

Floating Point Reference

“Fractions are your friends.” This was my high school algebra teacher’s standard response when students complained about the sometimes tedious math that they could require. Many years later, I’m finding that while floating point math, while not tedious, is still rather more involved than it appears at first; here’s my attempt to summarize issues that may come up.

» Continue reading…

NaNs, Uninitialized Variables, and C++

I’ve become a big fan of fail fast programming, or what Matthew Wilson colorfully refers to as “hairshirt programming.” In other words, if I make a mistake in my code, or if I use a piece of code in a way that violates the assumptions under which it was written, I want to know as soon as possible. C++ is fairly good at doing this at compile time, thanks to a static, reasonably strong, extensible type system, and thanks to add-on features like BOOST_STATIC_ASSERT. For problems that can’t be detected at compile time, the liberal use of assertions can help enforce preconditions and postconditions, and classes like std::string and boost::array add error checking over C-style strings and arrays.

» Continue reading…