Mouse vs keyboard quotes of the day

My two favourite quotes I’ve remembered from today’s thread about programming using a proportional font and other stuff that happened on, as busy as always, ACCU mailing list:

For me, when coding I think fast and I type just as fast, and every time I have to touch that stupid mouse I curse the idiot who failed to add or, worse, removed (which seems to happen as software “evolves”) the menus/shortcuts/tabbing-logic that would allow me never to lose my thread, or efficiency.

— Matthew

and

I’ve watched people using IDEs (mainly on Windows) and usually I wonder if I’m going to die of old age before they finish carrying out various simple editing tasks by searching through menu trees, navigate through dialogue boxes, clicking on this option and that option (…) I often wonder if I should only have to work 20 hour weeks as I can get my typing-in work done twice as quickly as some other people :)

— Stewart

Signed, with both hands.

Traits of void resolved

It looks like I’ve got clarified status of the traits of void type. I posted my question to libstdc++ where Paolo Carlini kindly provided me what the bits I have been missing. Now, all the puzzles are in place:

[n1836], the specifications for the TR1 features mandates true for is_pod<void>, etc. Arguably this is a defect, which has been fixed in the ongoing work for the next standard, so-called C++0x.

The TR1 document in section 4.9 states:

8 It is unspecified under what circumstances, if any, is_pod::value evaluates to true, except that, for all types T:

is_pod<T>::value >=
   (is_scalar<T>::value || is_void<T>::value);

Given that, the bug report ID:458570 I submitted to Visual C++ 9.0 and it’s TR1 implementation on Microsoft Connect stays valid and according to what Stephan T. Lavavej confirmed in comments to my report, it’s been fixed in Visual C++ 10.0.

Paolo also added a note particularly important to programmers relying on C++ implementation by GCC compiler and libstdc++ library:

In general, we consider TR1 essentially frozen at this time and minimally maintained, consider that it was just an interim Technical Report

Here are references that are fundamental for the matter:

  • n1836 – Draft Technical Report on C++ Library Extensions
  • n2960 – Working Draft, Standard for Programming Language C++
  • Implementation of is_pod<T> and the rest of type traits by Boost.TypeTraits library.

Mission accomplished ;-)

Traits of void

Long time ago, I reported bug to Visual C++ 9.0 (Visual Studio 2008 SP1) complaining that has_trivial_destructor applied to void returns true (ID:458570). I also discussed it with folks on comp.std.c++ where, among quite different voices, Pete Becker writes:

[tr.meta.req]/8 in TR1 requires is_pod::value to be 1. n2857 is not a standard, and implementations of previous standards are not wrong for not doing what isn’t yet required of them.

and later concludes:

Under the current standard, using the name std::is_pod requires a diagnostic. So if you want to be literal, both compilers are “wrong”. Nevertheless, neither is really “wrong”, they just implement different non-standard versions of is_pod.

So, Visual C++ might actually not be wrong. Fair enough.

Today, I got back to this issue for a while a little extending my test program to use the type traits from both, TR1 and C++0x:

#include <iostream>
#include <tr1/type_traits>
int main()
{
using std::cout; using std::endl;
cout << std::tr1::is_pod<void>::value << endl;
cout << std::tr1::has_trivial_destructor<void>::value << endl;
cout << std::is_pod<void>::value << endl;
cout << std::has_trivial_destructor<void>::value << endl;
}

and compiled it with GCC 4.4.1:

$ g++ -Wall -pedantic -std=c++0x void.cpp
$ ./a.out
1
1
0
0

Now, my confusion has been raised to the power of 2. This is clearly a Polnische Wirtschaft or Czech movie or Turkish sermon

…let’s try to ask libstdc++ folks.

Strongly typed enum in Visual C++?

Not yet. Victor Bazarov confirmed in reply to my post that there is no official announcement nor rumours that Microsoft is going to include native implementation of scoped and strongly typed enumerations defined in C++0x in upcoming Visual C++ 10.0. That’s a pity!

Thankfully, Boost provides portable emulation of scoped enums. It is compatible with compilers that already support this feature like GCC 4.4.0 (thought it’s still buggy). Nothing is perfect :-)

Compilation of VirtualBox add-ins for Ubuntu 9.10

I’ve been using the upcoming Ubuntu 9.10 installed as a guest system on VirtualBox for a while without any big problems. After one of big updates I found that currently under development 2.6.31 kernel version was installed. So, I decided to rebuild VirtualBox Guest Additions and it failed. Digging the logs helped me to find out what was the problem:

/home/mloskot/tmp/vbox/linux/module/vboxvfs/utils.c:423: error: implicit declaration of function utf8_mbtowc

Should be simple to fix. However, it seems that signatures of nls.h functions in the kernel have changed or have been moved to new place which I have no idea about. I’m not a kernel developer but I like to dig codes. Thus, I unpacked the VirtualBox installer, found the victim – utils.c and applied a very ugly fix:

extern int utf8_mbtowc(wchar_t*, const __u8*, int);
extern int utf8_wctomb(__u8*, wchar_t, int);

At least, it allowed me to compile and install the VirtualBox additions. I haven’t notice any run-time issues. I have reported this problem back to the VirtualBox as its code may need to be updated: #4823 (Missing declaration of utf8_mbtowc function in utils.c). So far, so good.

Iterators Must Go!

I’ve already announced the brilliant and provocative presentation given by Andrei Alexandrescu titled Iterators Must Go!.

Here is video of Andrei’s keynote digged to boostcon.blip.tv:

It may seem this is a C++ oriented presentation, but in fact it’s more related to software design, design patterns and idioms, interface oriented design, programming by contract and…shortly, it’s really worthwhile to watch, during lunchtime of course ;-), and enjoy!

ATL Security Update

Those of you who use Visual Studio in daily work have probably noticed there is has been new security update issued for Active Template Library. The Channel 9 also published very interesting webcast in which three engineers from Microsoft explain what’s inside the update for ATL.

Developers who have built controls using vulnerable versions of ATL should take immediate action to review and identify any vulnerabilities, modify and recompile their affected controls and components using the updated versions of ATL and finally distribute a non-vulnerable version of the controls and components to their customers.

Along with security fixes, the update includes one more interesting feature. Damien Watkins announced (12 min 20 sec) that now:

you can include ATL as a kind of header only implementation

I suppose, it may make it easier to port ATL features to development environments produced by parties like MinGW, so users of these will likely be able to use Windows Template Library (WTL) based on ATL. I’m dreaming, am I?

Inside the Active Template Library (ATL) Security Update | Jul 28th @ 10:02 AM