We have a very nice exception handling system... except
for it doesn't work

Today, finally, after a couple of days of totally
unproductive coding and a sudden inspiration, I've fixed
the exception emulation system in the C++ libraries of our
project at work.

We have a set of class libraries that is supposed to be
portable between Win32 and various hand-held devices (Palm,
EPOC, WinCE), but the small devices do not provide C++
exception handling, and the libraries rely on it heavily.
So last summer we implemented a complex exception emulation
framework with more or less complete support for stack
unwinding. It worked very fine, pushing objects on the
stack and pulling them from there, except for one minor
thing: every time you threw an exception, it crashed.

Nobody did any active development for the devices, so
nobody pushed too hard to get this thing fixed, but now the
time came that my colleagues needed the code working. The
project that I promised to do in two or three days
(updating the code for the latest version of the Symbian
platform and fixing the exceptions) stretched into more
than two weeks of Web surfing, complaining about the
bloated emulator that loads for 3 minutes and hangs your PC
to death once in a while and other not really productive
tasks. Well, I did write some code, but not too much of
it...

And today at last, after my colleague advised me to look if
the problem could be reproduced in a minimal test under
Win32, I found the reason of the problem in just some half
an hour... (When working on something that is totally
uninteresting and unmotivating, I sometimes feel like I'm
doing everything possible to avoid getting the problem
solved. Not a really professional attitude, I guess.)

When I saw the reason, I first thought that it was
theoretically impossible to get the problem fixed. But once
I explained the problem in details to my friend over ICQ, I
immediately came up with the solution... So much for having
someone to listen to you, even if he doesn't say a word.