The Old New Thing

The invisible price reduction

Swedish discount warehouse chain Coop Forum is running an advertising campaign claiming "New Lower Prices!", but how can you tell? Apparently you're not supposed to (shocking!) compare current prices against what they were before the ad campaign. Raymond's bad translation follows. Coops "new" price reduction not new A major new price ...

Pointers to virtual functions with adjustors

As a mental exercise, let's combine two mind-numbing facts about pointers to member functions, namely that all pointers to virtual functions look the same and that pointers to member functions are very strange animals. The result may make your head explode. Consider: Here, the variable consists of a code pointer and an adjustor. The ...

Why does the debugger show me the wrong virtual function?

Pointers to virtual functions all look basically the same and therefore, as we learned last time, all end up merged into a single function. Here's a contrived example: If you take a look at and you'll see that the point to the same function: That's because the virtual functions and are both stored in the same location relative to ...

Why does the debugger show me the wrong function?

Often you'll be minding your own business debugging some code, and you decide to step into one function and the debugger shows that you're in some other function. How did that happen? You then step through code that does something like this: And when you step into the call to you find yourself in . What happened? What happened is ...

Psychic debugging: Why your expensive four-processor machine is ignoring three of its processors

On one of our internal mailing lists, someone was wondering why their expensive four-processor computer appeared to be using only one of its processors. From Task Manager's performance tab, the chart showed that the first processor was doing all the work and the other three processors were sitting idle. Using Task Manager to set each process's...

Confusion over whether you have Windows XP SP1 or SP2

Some support people have asked me why the "About" dialog seems to be kind of schizophrenic as to whether a machine has Windows XP SP1 or SP2. About Windows Microsoft® Windows Version 5.1 (Build 2600.xpsp2.040919-1003 : Service Pack 1) Copyright© 1981-2001 Microsoft Corporation Why does the version string say "xpsp2...

Your exception handler can encounter an exception

Consider the following code, written in C# just for kicks; the problem is generic to any environment that supports exception handling. Some time later, you find yourself facing an assertion failure from claiming that you are destroying the document while there are still active plugins. But there is your call to , and it's in a block, and...

Competing to be the worst-dressed couple in America

The U.S. cable network TLC is putting on a special episode of What Not to Wear devoted to identifying the worst-dressed couple in America. It so happens that one of my friends knows one of the finalists, so we'll be rooting for them. Or is it against them? Are you supposed to hope that your favorite is in fact the worst-dressed? Or should ...

The great Alaskan ice sculpture

NPR interviewed John Reeves, the artist behind a 160-foot-tall mountain of ice in Alaska. The man has a down-home aw-shucks kind of demeanor that I found quite charming. I'm a middle-aged guy that has a lot of time in the winter and a little bit of extra money to play with, so my hobby was to see how big an ice hill I could grow. I started ...