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…


How ! to code

A little rant to prove I’m still alive. 🙂 Here’s a pattern I see every now and then that makes my brain explode. This is a simplification, but the two bools that are named exactly the same except the word “Dont” are real, as is the “partial assert” and not-completely-mutually-exclusive logic that follows. Can anybody explain why you would…


XP SP2 fixes

One interesting change I discovered in XP SP2 was that Subspace Continuum — the first and (by far) best massively multiplayer online game — now runs on XP without entering an infinite loop trying to launch the process. This only repro’d under certain accounts, and I suspect it was a bug in their anti-hacking/cheating code, but SP2 seems to fix…


Breaking-in electronics

For best performance, you should make sure to break in your cables. Otherwise, you may be getting substandard audio performance and transfer rates – I hear that breaking in your modem cable will let you get 64kbps out of a standard 56k modem!. 😉


Expression 3: Vector drawing application available for download

As others have pointed out, Microsoft has made available a free download of Expression 3, apparently acquired from Creature House. My first impression, having only played with it during breakfast and lunch, is that it’s a very cool app. It has a standard, user-friendly palette-based UI with a few interesting quirks — a good antidote to applications…