The Inline Returns Option

Using my last example, Stuart Ballard pointed out that using inline returns is another way to avoid the uninitialized variable mistake:if (hwndParent != NULL) { if (fFoo) { return DoOperationWithFoo(hwndParent); } else if (fBar) { return DoOperationWithBar(hwndParent); } } return whatever_the_default_return_code_should_be; This is true, although whether to use inline returns vs. the structured programming technique…


More Micro-optimizations

Here’s another micro-optimization that I’m not very fond of. I should note that we don’t really obsess about these things too much internally – in general we have established coding practices and only occasionally debate a few debatable things, usually on the fringes. But they do make reasonable blog fodder and I’m trying to cover…


The Risk of Micro-optimizations – follow-up

In yesterday’s post I gave an example of a bug where an attempted micro-optimization combined with a common C++ idiom causes a fairly subtle bug. For those who didn’t look long enough to catch it, the flaw was in these two lines:BOOL _fRaining:1; _fRaining = (dwFlags & WEATHER_RAINING); The assumption that the coder was making…


The Risk of Micro-optimizations

A lot of things have been said over the years about premature optimization, and after running into the following bug I thought it served as a good example of a type of premature optimization that I call “micro-optimization”. That is, doing something quirky in order to save a tiny amount of RAM or CPU cycles….


RAW Conversion and Photo Manipulation

Last fall I purchased a digital SLR: the popular (and relatively inexpensive) Canon Rebel XT. I had been dabbling with digital cameras for a few years and was having increasing amounts of fun using the limited manual controls of my Canon S50. As a technical person part of the draw is simply learning about the…


Bug Triage

Eric Sink has a good article on the process of triaging bugs. In it he pokes a little bit of fun at the people who don’t understand why all good software ships with known bugs and then discusses a process for determining which ones to fix. Determining which bugs to fix and how to prioritize…


Toolbar Compatibility Debugging Walkthrough

In the past I’ve found debugging walkthroughs useful for picking up new techniques. In that spirit here’s a quick rundown of a bug I was investigating today that may have some useful tidbits.   This was a crash in IE that involved a toolbar that I didn’t have the source code for. The issue was that if…