Sunday, February 26, 2012

My reactions to Stroustrup's keynote on C++11 style

I finally got around to watching this on channel9. Now, I don't do much C++ myself these days, since most of the code at work is in C#, and the language is rather high in ceremony (e.g. header files) for out of hours playtime, compared with the broad spectrum of widely available and popular languages there to choose from these days; but I do from time to time, so it's always good to see where things are going.

Interestingly, for a C++11 talk, a good 60% of it was about how we could drag the usual run of C-with-a-cpp-file extension code kicking and screaming out of the 1980s and into the early 21st century. In-language lambdas, async/futures and move constructors were touched upon, but where real world examples were talked about, it was showing how actual live code wasn't taking advantage of features that have been available in compilers for the best part of a decade, or longer, to make code simpler, more maintainable, and faster -- often considerably faster. And when I have to do some C++ and have been greeted by files full of almost-C-in-files-with-cpp-extensions, written by people who are writing native most of the time, I know that feel, bro :

>Not using RAII


The "a lot of people don't know that" moment -- when doing random access insertion or deletion from a sequence, the random access part dominates the insertion/deletion reshuffling to such an extent that whatever the collection size, use a vector rather than a list.

The big takeaway -- despite the folklore, going to low-level 'C' style constructs is premature optimization. The machine code generated by the higher level constructs is often exactly the same as for the hand-crafted lower level code; and at times can be better, as the compiler has more context for optimizations.

Heh, almost makes me want to do something with the language again, if only to keep my hand in.

Saturday, February 25, 2012

Signs of the times

A few weeks ago, we went to the Arts Theatre to see Cheek by Jowl's production of the overwrought Jacobean tragedy 'Tis Pity She's a Whore. Entering the auditorium, we were presented with a sign warning that the production contained nudity and bloody violence. Fair enough, given that these days when a character murders and dissects his sister, that sort of thing naturally occasions buckets of the old Kensington Gore for audiences oft rendered blasé by the various species of torture porn that runs through cinemas without any shrieking of "Look -- a video nasty!!".

Today, we went to see the Marlowe Society's production of A Midsummer Night's Dream; and the warning this time was that there would be smoking on stage.

Is this what we have descended to, that when a production decides that Oberon shall open the second half lazily waving a cigarette as he observes the chaos he has occasioned, that we have to warn the sensitive of the fact?

Some people need to grow the hell up.

Monday, February 06, 2012

Dear Diary,...

January was a rubbish month for cycling -- a total of 15.2 miles logged. And February being winter, maybe not so much better.

After having passed 4000 miles on the way back from last holiday, the car went past 5000 coming home from work last Thursday (on a day when it was -4 all journey in, and still sub-zero for going home time).

Cold weather at the end of last week came of a sudden, and I'd forgotten to replace the bubble-wrap over the pond; so Saturday morning that was 2" thick with ice, humped under the plank that was supposed to protect against gentle frost, more than enough to take my weight, but I managed to cut a belated air-hole -- most of the way through with a pruning saw, then hot water for the last bit. That let water gush out from below, and then I could chip away until there was a reasonably sized hole.

I also harvested some sprouting broccoli ahead of the snow that fell after dark as a warm front came over.

Sunday morning was snow-clearing so that Karen's morning call had somewhere dry to park -- but even then the snow was starting to thaw on the car. The amount of snow meant that it didn't shift in a hurry -- the close was quite deep in slush this morning; and I was glad I packed a shovel, as I needed to dig myself clear several times in the car-park at work.

Coming home early to work remotely for the afternoon, I didn't need to dig past what I'd already cleared, but the traction warning was going all the time I was in the car-park. The rest of the drive was just wet -- much black ice if it frosts tonight -- and the close almost clear.

Forecasts this morning were also rubbish -- the Met Office said it was foggy; The Weather Outlook (Forecast issued: 06/02/2012 08:06:10) that it was -5C when Cambridge airport latest METAR reported

Time: 07:50 UTC
Visibility: 8000 m
Clouds: Broken sky, at 800 feet above aerodrome level
Temperature: 1C