The Old New Thing

The C language specification describes an abstract computer, not a real one

If a null pointer is zero, how do you access the memory whose address is zero? And if C allows you to take the address one past the end of an array, how do you make an array that ends at , since adding one to that value would wrap around? First of all, who says that there is a byte zero? Or a byte ? The C language does not describe an ...

“Adjust visual effects for best performance” should really be called “Adjust visual effects for crappiest appearance”

In the Performance Options control panel, on the tab labeled Visual Effects, there is a radio button called Adjust for best performance. If you select it, then all the visual effects are disabled. But the name of that radio button has been wrong for a long time. It doesn't actually adjust your visual effects for best performance. It just ...

Using accessibility to monitor windows as they come and go

Today's Little Program monitors windows as they come and go. When people contemplate doing this, they come up with ideas like installing a WH_CBT hook or a WH_SHELL hook, but one of the major problems with those types of hooks is that they are injected hooks. Injection is bad for a number of reasons. It forces the hook to be in a DLL so it ...

When will GetMessage return -1?

A source of great consternation is the mysterious return value from : If there is an error, the return value is −1. For example, the function fails if is an invalid window handle or is an invalid pointer. That paragraph has caused all sorts of havoc, because it throws into disarray the standard message pump: But don't worry, the ...

The x86 architecture is the weirdo: Structured exception handling

If your reference architecture is x86, then you will think that everything it does is normal and the rest of the world is weird. Except it's the other way around: The x86 architecture is the weirdo. I was reminded of this when commenter 640k complained, on the subject of what I think is table-based structured exception handling, "It would ...