What’s wrong with this code, part 15 – the answers

Well, that was certainly interesting.  My last “what’s wrong with this code” post had to do with a real-world bug in some of the notification infrastructure that’s used for audio.  I took some sample code done while developing the prototype, and stripped out anything that would have described the actual infrastructure (NDA issues, sorry :))…


Another Surreal moment

I was listening to NPR while driving around this afternoon.  They had a report by Libby Lewis on “Scooter” Libby. Somewhere over in NPR-land, there is a producer that is just laughing his socks off.  I don’t know how on EARTH they managed to arrange a Libby Lewis story about Lewis Libby, but…  


What’s wrong with this code, part 15

Work’s been pretty hectic lately, that’s why so few posts this month, but I ran into a real bug in my code recently that I realized would make a GREAT “What’s wrong with this code” post.  HRESULT CNotification::GenerateEvent ( PNOTIFICATION_BLOCK NotificationBlock ) { HRESULT hr = S_OK; BYTE *buffer = NULL; DWORD bufferSize = sizeof(NOTIFICATION_HEADER)…


Does Visual Studio make you stupid?

I know everyone’s talking about this, but it IS a good question… Charles Petzold recently gave this speech to the NYC .NET users group. I’ve got to say, having seen Daniel’s experiences with Visual Basic, I can certainly see where Charles is coming from.  Due partly to the ease of use of VB, and (honestly) a…


A really quick followup to the "No Easter Eggs" story

Man, it’s just been the fall for running into old friends and colleagues.  In the past month alone, I’ve run into three different classmates from college, and co-workers from over the years.  Go figure that one out, I have NO idea why they all caught up in the past month, but it’s been REALLY cool…..


Why no Easter Eggs?

Yesterday’s post caused a bit of a furor in the comments thread.  A large number of people leaving comments (and others) didn’t understand why the OS division has a “no Easter Eggs” policy. If you think about this, it’s not really that surprising.  One of the aspects of Trustworthy Computing is that you can trust…


Early Easter Eggs

Jensen Harris’s blog post today talked about an early Easter Egg he found in the Radio Shack TRS-80 Color Computer BASIC interpreter.   What’s not widely known is that there were Easter Eggs in MS-DOS.  Not many, but some did slip in.  The earliest one I know of was one in the MS-DOS “Recover” command….


Activate-As-Activator activates as activator

This particular problem burned my team somewhat the other day, so I figured writing a blog post about the issue was a good thing. When you activate a COM object (with CoCreateInstance), one of the things that COM has to do is to figure out the activation model for the newly instantiated COM object. Most…


Unintended consequences of adding APIs to the system

Yesterday, I wrote about a trick to reduce the number of bits in a number by one. It turns out that I’ve only ever had one opportunity to use this trick (although I ran into an instance of it when code reviewing some stuff the other day), back when I was writing the NT 3.1…


Another of my favorite tricks – reducing the number of bits in a number by 1

One of the classic (and thus no longer asked) Microsoft interview questions is “How quickly can you count the bits in a 16 (or 32) bit integer?”. You get a varied number of responses to this one, from brute force to lookup tables. One of my favorite tricks for this is:    x = x &…