Beware! The rules for when a destructor is called for a managed C++ class in Visual C++ are different than for “normal” C++ class.
Jochen Kalmbach recently posed a simple question about a managed C++ class; “Will the destructor be called in a managed class if the constructor has thrown an exception?”. The answer and the comments are illuminating and, to be honest, somewhat annoying.
In summary, yes, the destructor is called even if the constructor doesn’t complete, see here for more details.
Am I a curmudgeon of technology? You betcha - Ted Neward over at “The Blog Ride” explains why he’s cynical about new technology and suggests that we’d do well to have a little more cynicism. I agree with him, I tend to take a similar position having been let down by various “silver bullets” in the past. I think I decided that it was my time spent working with OLE DB providers that caused me to be more cynical towards the Microsoft technology hype machine; When someone brings me a “cool” new technology and claims that because simple things are so easy to do in a sample my complex problem will also be easy to solve using the technology I ask to see the code that solves my problem…
VirtualKeyboard.jpg I recently purchased an iTech Bluetooth Virtual Keyboard for use with Michelle’s PDA. It’s basically a little box that’s about the size of two packets of chewing gum with a red window in the top. It projects a keyboard onto a flat surface and detects when you press the keys. It’s one of those devices that looks too cool to work, but it does, kinda… Unfortunately there were driver problems with the iPaq 4150 that meant that it would work for around 20 keypresses and then stop, reset itself, reconnect and then start working again… At first I thought that it was a problem with the keyboard but it worked fine with my laptop (though that’s hardly the point!
LEGO has announced a new version of their Mindstorms autonomous robot building system. I did a fair amount of playing around with the original Mindstorms kit way back when and created a system that allowed you to control your robots over a NetMeeting connection. The new Mindstorms NXT system sounds pretty cool. I like the idea of being able to use bluetooth to control and download programs to the robots and the new sensors sound much more complex than the old stuff.
There’s the first part of what I expect to be a very nice article about programming by contract in C++ over at The C++ Source: The Nuclear Reactor and the Deep Space Probe.
Updated 3rd Jan 2006 - the article now appears to be called Contract Programming 101.
As I mentioned a while back, I got a Garmin eTrex Vista C handheld GPS as a Christmas present and there’s code available from the Garmin website that lets you talk to it via its USB interface. There’s also a specification document for the protocols that it uses. At first glance this is great. I’ve seen better specifications but with a little trial and error I’ve managed to transfer the saved GPS tracks from the device to my code and I can set the device up to send it GPS position every couple of seconds (so I could use it as an external GPS receiver for mapping software) etc.
Does anyone in IT use paper clips for anything other than resetting hardware either by pressing those hard to reach reset buttons or by shorting out bios batteries, etc?
I got a Garmin eTrex Vista C handheld GPS as a Christmas present. Another cool tool to add to my geeky ski stuff. So far I’ve only used it to navigate to and from a restaurant yesterday lunch time, but it seems to have lots of features that will make it useful on the mountain. The best thing about it? There’s an SDK that you can download to communicate with the device.
There’s an interesting article by Tomer Abramson in this month’s Dr Dobb’s Journal about deadlock detection. He provides a compile in tool that works in a similar way to my deadlock detection tool and reports on potential deadlocks in code even if they never occur during the program run in question.
His architecture is considerably different to mine but the idea is the same. By recording the sequence of lock acquisition and release on all threads in the program you can then examine the sequence that locks are taken out and spot potential deadlocks.
I’ve just finished the first cut of the code that handles the Win32 Thread Naming “API”. This means that my debugging tools can now report the name of a thread (if it has been named) rather than just its thread ID. Having implemented the code in the debugger to deal with the exception I find myself wondering about API design and why the original designer of this particular facility decided to make it hard on themselves.