Friday, September 23, 2005

Humbling Syntax

Work has been a bit slow lately, mainly because I have had to wait for other people to complete some tasks before I have much to do. Unlike some of the people discussed here, even when I "waste time" at work, I try to find something I can justify its benefits to my employer. So I spent time this week trying to learn more about the C++ Standard Template Library with the help of The C++ Programming Language. I actually own two copies of this book, one being an old printing from when I took Data Structures in college, and a more recent hardback printing. I use the old copy at work, and the new one at home. The old one had the following code:

void binary(int i)
{
    bitset<8*sizeof(int)> b = i;
    cout << b.template to_string<char>() << '\n';
}

Which even Stroustrup says:
    Unfortunately, invoking a an explicitly qualified member template requires a rather elaborate and rare syntax.


I found this rather humbling, as this isn't something I would have even recognized as legal standard C++. But wait, it doesn't compile. After deciphering error messages, it appeared Microsoft had omitted default template parameters for the character traits and allocator. So, I added the template parameters making the code look like this:


void binary(int i)
{
    bitset<8*sizeof(int)> b = i;
    cout << b.template to_string<char, char_traits<char>, allocator<char> >() << '\n';
}

After getting a successful compile, I tried googling missing template default parameters in <bitset>, but didn't find anything. As I say down to start this blog post, I grabbed my newer version of the book, and sure enough, the first code snippet had been replaced with the second. I am not sure if it was a printing error in the earlier edition or if changes had been made to the STL. I am not sure I care, either. But I do take comfort in knowing that the Visual Studio .NET 2003 STL implementation is correct in this regard.

Tuesday, September 20, 2005

The Inevitable Return of the Great White Dope

So, after much chastising from various friends, I have decided it is time to update this thing. I suppose many of you are reading mainly to find out my pirate name, but you'll have to wait until the end.

Bowling has started. We are four weeks in and Andy is owning me. He has shot 725, 715, 624, 697 to my 686, 570, 690, 535. Notice my schizophrenic scoring pattern. One week, I am ready for PBA regionals, the next I should join a mixed league or just do Rock 'N Bowls or something.

The week of the 570, I get a flat tire on the way home from bowling. Just the way I like my flat tires, this one occurred at SW 104th and May at about a 9:45 PM. So SW 104th and May is about equidistant from luxury homes and meth-riddled apartment complexes. I was really excited to become completely absorbed in changing my tire with my back turned to the entire world in such an environment.

Apparently alloy wheels like to bond to the axle, because even after removing the lug nuts, I was still unable to get the wheel off. I finally gave up, and called my dad, leaving my beloved ride at a point equidistant between luxury homes and meth-riddled apartments.

Armed with my father, a rubber mallet, irritation, and several new strategies for removing the wheel, I returned determined to change the tire. After about forty-five minutes for wrestling, the wheel comes off rather anti-climactically. An hour and half and $160 later, my car is restored to its former glory.

OK, so here is my pirate name.



My pirate name is:


Dirty Sam Kidd




You're the pirate everyone else wants to throw in the ocean -- not to get rid of you, you understand; just to get rid of the smell. Even though you're not always the traditional swaggering gallant, your steadiness and planning make you a fine, reliable pirate. Arr!


Get your own pirate name from fidius.org.