The Old New Thing

You can't rule out a total breakdown of normal functioning, because a total breakdown of normal functioning could manifest itself as anything

A customer was attempting to study a problem that their analysis traced back to the function returning . Is it a valid conclusion that there is no heap corruption? While heap corruption may not be the avenue of investigation you'd first pursue, you can't rule it out. In the presence of a total breakdown of normal functioning, anything can...

Adventures in undefined behavior: The premature downcast

A customer encountered the following problem: The function converts the cookie back to a object, and then checks if the object is a object by calling . If so, then it does some more stuff to figure out what type of paint to buy. (Note to nitpickers: The actual scenario was not like this, but I presented it this way to illustrate the ...

I'm not calling a virtual function from my constructor or destructor, but I'm still getting a __purecall error

Some time ago, I described what is for: It's to detect the cases where you call a virtual method with no implementation (a so-called pure virtual method). This can happen during object constructor or destruction, since those are times when you can validly have a partially-implemented object. Well, there's another case this can happen: If ...

Wait, you never said that I had to initialize the object before I used it!

A customer reported that they were having trouble creating slim reader/writer locks at runtime. They simplified the issue to a short program: "What is the correct way of creating an via the operator?" It wasn't long before somebody noted that nowhere in the code is the function called. "Oh, yeah, thanks for catching that. It looks ...

How do I customize how my application windows are grouped in the Taskbar?

Benjamin Smedberg wants to know how to customize the icon used in the Taskbar for applications that are grouped, when the application is a runtime for multiple applications. (This is the other scenario I hinted at last time.) Actually, customizing the icon is only part of what you want to happen when your application is a runtime. In that...

What if my application is really two applications bundled into a single file, and I want them collected into two groups on the taskbar in Windows 7?

A customer wanted to prevent multiple copies of their program from being grouped on the taskbar. They didn't give an explanation why, but let's assume that they are doing this for honorable purposes rather than as a way to annoy the user. For example, maybe their program is really multiple applications bundled inside a single EXE file for ...

FORFILES, for your fancier batch file enumeration needs

Crack open open the champagne: Batch File Week is finally over! Variations on the will let you repeat an operation on the contents of a directory, possibly even recursively if you add the option, with some basic attribute-level filtering if you add the or /a- flags. For your fancy recursive file operations, there's a tool called which...

How do I find the most recently created file in a directory from a batch file?

We've reached Hump Day of Batch File Week. Remember, nobody actually likes batch programming. You merely tolerate it. Today, we'll find the most recently-created item in a directory. (For example, we have a server that holds our daily builds, and you might want to write a batch file that automatically installs the latest build.) There may...