C++ Templates, avoiding virtual

I’ve not done a great deal with C++ Templates, and especially with some of the improvements in C++0x, I’m thinking I’d like to change that.

One particular example I’m tinkering with right now is a database abstraction layer I’ve been dragging around with me for years. It has two primary members: DBQuery and DBRow. Up until now they have been littered with #ifdef’s. I want to ditch the ifs and switch to templates.

Stupid autoconf…

I cannot get it not to add these defines to everything:


even though I’ve added “AM_INIT_AUTOMAKE(… no-define …)” as the autoconf documentation claims will make them go away.


Mono vs Java

There is a slowly emerging community of .NET developers for Linux in domains that were traditionally strongholds of Java and C++/C developers. Linux people developing with a Microsoft language? The simple “we won’t sue you” promise doesn’t explain it.

And then the penny dropped… Perhaps, Better the Devil You Know?

Question: SSD/Win7

Anyone have any experience running SSD drives under Windows 7? Google returns a mishmash of opinions. I’m going to drop a little 32Gb drive into my Win7 box at work as a secondary drive to host Visual Studio, my development files and probably my Linux virtual machine.

Any special tweaks I’m going to need or does Windows 7 handle SSD well, out-of-the-box, like it promises?

C++ Closures

The upcoming C++0x standard has already ratified the Lambda Expression concept, which is also being touted as closures. Kinda.

I’m not keen on the syntax, at all. It’s ugly. Even Herb Sutter fumbles with it. The whole thing feels hacky and grumble-grumble-give-them-something that lets you do it.

The problem with a closure is that you want to have your cake and eat it. You want to be able to pass around a pointer to a piece of code to execute, but then you probably want it to be stateful and packaged with a bunch of data.

You can use a struct/class with an operator() functor to implement this, and that’s OK as long as what you are passing the object pointer to knows that’s what you are doing.

But that is not very often the case, especially if you have to go through an API. Infact, function pointers are generally a PITA of C++ programmers.

A little less pain while I upgrade please…

I’ve never heard of anyone choosing to save money by buying a new car without the interior (seats, dash, steering wheel) or plumbing, and just moving over the ones from their old car.

But that’s what we so often do when we upgrade our hardware… And right now I am doing my two office PCs and my home Win7 box. I’d really only just about gotten done installing my stuff¬†onto it.

Fortunately, Dana put me onto something that can take a huge chunk out of the headache: http://www.ninite.com/

And below, some notes from my migrations…

Transferring Putty settings

Ever tried to migrate your Putty settings from one system to another? It turns out it’s a one-liner. At the Start > Run or “Search Programs and Files” input box, simply paste:

regedit.exe /E "%UserProfile%\Desktop\putty-settings.reg" "HKEY_CURRENT_USER\Software\SimonTatham"

For some reason, under XP, doing it from the Run prompt mean’t fiddling with case, whereas doing it from a DOS command prompt didn’t care about case (“%UsErPrOfIlE%” and “%USERprofile% and “%userprofile%” all worked, and so did “/e”).

Smith’s Law

Moore’s Law: the number of transistors that can be placed on an integrated circuit would increase by 200% (double) every two years.

Smith’s Law: the number of transistors required to run any given software product increases by 205% every two years.

1.31 open beta next week


Do you miss seeing what defrag is doing?

Try defraggler instead :)