So, lets try this blogging thingumy. I'm obviously not going to do the easy thing and use someone else's software, so I'll hack up a Perl program to do it. The obvious thing (really) is to write it as XML and have a program which turns it into a webpage, so lets try that.
Work and pub discussions today have focused on:
- The horrible horribleness of some of the more obscure syntax and semantics in C++ (I'm involved in writing a training course about it)
- The problem's our in-house admin system (mostly based on RT) is causing us, because we've got a stack of critical problems which need to be fixed but can't agree whether to fix the critical ones now or accumulate a big pile of development work to rework the whole system somewhere down the road
On the subject of C++, we discovered today the whole nasty
‘try-block function body’ thing, which allows you to omit
the braces around a function body in certain cases. This isn't just
for terseness: it changes the interpretation of the function. If you
have a constructor with an initialiser list, a normal function body won't
be able to catch exceptions thrown while dealing with the initialisers.
The initialiser list is outside the function body, so try
blocks in the function can't catch exceptions thrown there. So C++
has a ‘special’ form of constructors which allow try
blocks to wrap around the function and the initialiser list.
Here's an example (note the yucky bit after the keyword
try):
#include <iostream> #include <stdexcept> using namespace std; class Wobbly { public: Wobbly (int) { throw runtime_error("wobbly in initialiser list!"); } private: Wobbly (); // I'm disallowing this, so there. }; class Foo { Wobbly w; public: Foo (); void do_something () const { cout << "Foo object is alive" << endl; } }; Foo::Foo () try : w(23) { cout << "Foo::Foo() called" << endl; } catch (exception &e) { cerr << "Exception in Foo::Foo(): " << e.what() << endl; throw runtime_error("C++ nastiness worked!"); } int main () { try { Foo x; x.do_something(); } catch (exception &e) { cerr << "Exception: " << e.what() << endl; } }
Hmmm, for some reason my gvim isn't (currently) allowing me
to use Ctrl+C to switch from insert mode to normal mode. I've got used to
being able to use it as an alternative to Escape, and I often find it
easier to type, since I find it less strain on the fingers to press a
two-key combination than stretch my left little finger to the Esc key. It
might be something I broke twiddling with my xmodmap, since I think it
still works on the machines at work. Something to look into.
Ah, I've realised why my Vim was breaking. I'd installed ‘vimacs’ to see what it could do (since I like some things in Emacs and some in Vim, and in theory it would be nice to have the best of both worlds). I've uninstalled it to make things sane, but I'll have to have another look at it, if only to learn some more Vim macro tricks. For some reason it broke my XML close tag function, which made writing this a bit tiresome.