BOOST_WITH Reloaded

During preparation and presentation of a Lightning Talk about my BOOST_WITH Macro at the C++Now 2015 Conference, three important issues showed need for being addressed:

  1. The if statement solution with an unused (and useless) condition variable leads to compiler warnings. This is a noteworthy fail, since compiler warnings were part of my motivation for developing the macro in the first place!
  2. You could write code like
    BOOST_WITH(whatever) {} // if(true) {}
    else foo();
    

    – which is clearly not desirable.

  3. An alternative implementation, using a single-pass for loop suffers a similar problem – you could break and continue in a BOOST_WITH block.

The Macro clearly had to be revisited…

Continue reading

Python style ‘with’ in C++

I have developed a simple macro that enables Python style ‘with’ in C++.

This being said, I feel the urgent need for a short foreword…

  • Yes. ITS_A_MACRO. If you’re already tempted to email me about how bad an idea macros are, go ahead. I can take it. Naturally, I would prefer this to be part of the language.
  • This is not about enabling Python style programming in C++, but about bringing in a nice concept from another language. Think about it: Python is very similar to C++ with respect to resource ownership and management (RAII).

The motivation are familiar bugs like these:

Continue reading

Who got the balls?

I just have to publicly state my complete disappointment with international politicians.

Please, could one – just one – country in this world have enough balls and grant asylum to a whistle-blower who is faced with unjust prosecution in his home country – by the way, a country where murder is a routine form of punishment?

Maybe if I told you this man made an invaluable contribution to maintaining freedom and privacy word-wide?

Anyone?

NETGEAR ReadyNAS

I recently purchased a NETGEAR ReadyNAS Duo for my small home network. Having made the experience that NETGEAR make very good hardware with not-so-good firmware and virtually nonexistent and useless documentation, I had done some prior research and had found out the ReadyNAS is essentially a debian Linux box. Since I also wanted to use the box as a print server, I had also looked for and found a hardware compatibility list that included my printer.

My expectations were met. Continue reading

more wine trouble

Appears I got my hope up too soon (see here) – more trouble was to come. Runtime errors – different from the original one – kept occuring, no matter what winetricks I applied…

Until I finally found out what had gone wrong in the first place: winetricks mfc40 (or mfc42 for that matter) failed to install oleaut32.dll for some unknown reason. After manually unpacking and registering the file, all trouble was gone.

Obviously, I would be interested in why it was possible to fix one of the many errors by just applying a different locale, but I guess I’ll stick to the old never touch a running system rule now…

debugging a wine problem

I recently spent one and a half days trying to get a Windows application to run on an Arch Linux PC. The strange part: I had the application running for years without any trouble, and then…

After a wine update, I got some runtime errors. Thus, I decided to just reinstall the app – installing had always worked just fine. But no success. The runtime errors kept popping up.

OK, I thought – just go back to the previous wine version… Did that, same errors! Tried a really old version (1.2.something), same errors!

After many many attempts and many many Google searches, I found a solution by pure chance: I installed the application on a different PC, and transferred the WINEPREFIX directory – Success!

Why did this work? Well, both machines run Arch Linux, and both are up-to-date…

Turns out the only real difference was the locale setting: The machine that finally did the job uses an English user interface as opposed to a German one. Investigation showed winetricks failed to properly install one of mdac28, jet40 or mfc40 when a non-English locale was in use.