Archive for August, 2010

STL, language lawyers and pedantry

Monday, August 16th, 2010

Any­one who’s been around a C++ pro­gram­mer for any length of time has prob­a­bly real­ized that we tend to be hor­ri­ble lan­guage lawyers: we only trust the ISO stan­dard describ­ing the lan­guage. We cer­tainly would never assume some­thing to work just because the com­piler hap­pens to gen­er­ate code that works right now. If it’s not in the stan­dard, we can’t count on it.

I’m fine with that. It’s often annoy­ing that we have to be so para­noid, that we so often have to double-check that our code not only com­piles, not only passes our tests, but also avoids the dreaded Unde­fined Behav­ior (where the behav­ior is not con­strained by the stan­dard), but you get used to it. And all in all, being pre­cise and spe­cific when talk­ing to a com­piler is prob­a­bly not a bad habit to get into, regard­less of which lan­guage you pro­gram in.

How­ever, every once in a while, peo­ple try to carry the same level of pedantry over into dis­cus­sions about C++. (more…)