All posts by Chris

[c++] Static assertions – Part III

For completeness let’s look at the static_assert keyword introduced as part of C++0x. Picking up where the previous two posts (I & II) left off (in 2008!).

int main( ) {
    static_assert( false, "This must be true" );

    return 0;
}

Visual Studio 2010 outputs:
1>main.cpp(2): error C2338: This must be true

Hooray for progress!

A static assertion that outputs a user controlled error message. Making it much easier to indicate what the actual problem is, and avoiding the need to dig through large amounts of invalid and/or undefined type related compiler output mess.

Better yet; BOOST_STATIC_ASSERT will take advantage of static_assert if your compiler supports it.

#include <boost/static_assert.hpp>

#pragma pack( push, 1 )
struct PktData {
    char b1;
    char b2;
};
#pragma pack( pop )

BOOST_STATIC_ASSERT( 1 == sizeof(PktData) );

Visual Studio 2010 outputs:
1>main.cpp(10): error C2338: 1 == sizeof(PktData)

Where the error message is populated by the failing expression. Which may be nicer than having to specify your own error message as required by static_assert.

I Can Has Cheezburger Doritos?

I’m not sure how to describe the flavor of these. Somewhat like Burger Rings, but not quite, and in triangular chip form. Fortunately Wikipedia comes to the rescue and describes it as X-13D flavor. Which are exactly the words I was looking for.

In 2009, Doritos released some new flavors under the banner Doritos Late Night: Tacos at Midnight and Last Call Jalapeno Popper. They also modified the X-13D flavor as All Nighter Cheeseburger. –  Wikipedia

Thanks Nova!

Denver Botanic Gardens

Late afternoon of my last day in Denver was spent at the Denver Botanic Gardens. Which ended up being much fancier than I had expected.

A large amount of time, money, and effort has been poured into this place and it shows. Lots of areas to explore, sculptures to admire, and out of focus photos to take.

Looking through one of the many sculptures

Interestingly; all of the water features contained some kind of blackish dye. Which really helped with the water reflections. Not sure if that was the intended purpose, or whether it was to stop you seeing the normal mess that is the bottom. I’m guessing the later.

Another Henry Moore Sculpture

There is currently a large number of sculptures around the grounds that are part of a Henry Moore exhibit. Turns out that he first designs and creates a miniature piece of his work. Then gets one of his apprentices to create a much larger version of it for him.

I think I need to find myself some apprentices…

Hiking in the Rockies

Spent half a day attempting to hike to Sky Pond in the Rocky Mountains National Park in Colorado. Unfortunately the weather started to close in and we weren’t properly prepared for that. We did however, make it as far as The Loch before turning around.

The Loch – Rocky Mountains, Colorado, USA

Which was definitely worthwhile.

Wild blue yonder

Stumbled across an Airshow while in Colorado for the weekend. We only got to see the last of the vintage aircraft, but it was still impressive.

Gary Rower at the Colorado Sport International Airshow

I like the texturing in this shot, and decree that the rule of thirds does not apply.

I’m going to buy you so many lizards

There was a reptile expo being held at the Santa Clara fairgrounds a couple of weekends ago. Where you could go and check out a large variety of reptiles, get tips, and bring home an enclosure filled with your new cute and cuddly pet scorpion1.

Admittedly I did have thoughts of buying a pet turtle or lizard (you can keep the snakes and spiders). However, it turns out that looking after these things is quite the commitment. They require an environment, specialized lighting, regular cleaning, and of course food.

I on the other hand, can barely keep my one plant alive.

Maybe I’ll get a fish and bootstrap my way from there…

1. To be fair; I only noticed one of the vendors selling scorpions.