Saturday, February 23, 2008

Nothing to desire

From a subway poster:

If there is something to desire, there will be something to regret.

If there is something to regret, there will be something to recall.

If there is something to recall, there was nothing to regret.

If there was nothing to regret, there was nothing to desire.

Tuesday, February 19, 2008

Credit Suisse Writedowns

Write downs are not really news any more, but Credit Suisse's reasoning behind it is still worth noting:

Switzerland's second-largest bank took $2.85 billion of writedowns on asset-backed securities after an internal review found ``mismarkings'' by a group of traders and debt markets deteriorated. The Zurich-based bank said in a statement today that it's assessing whether 2007 earnings were also affected.

Now if a financial firm is still relying on traders to mark the price of securities, it's ought to be in big trouble... Where are the Risk Managers?

Toshiba threw in the towel

HD-DVD is officially history now. And what exactly does this mean for cosumers?

Saturday, February 16, 2008

Template, Forward Class Declaration and Typedef

Now that I'm back to the C++ wonder land, it's time to re-familiarize myself with the basic.

In C++, ideally, you should "forward declare" a class and only include its full declaration when necessary, since this would minimize the dependency relationship between files and cut down build time:

class A;
void foo(const A& a);

But things can quickly get problematic when there is typedef involved, for example in the previous case, if A is later typedefed as:

typedef B A;

Compiler will complaint that A is defined in two places with different type. To do this  cleanly, you need:

class B;                //forward declaration of B first
typedef B A;          //now typedef A
void foo(const A& a);

But what if B is a template, something like:

typedef vector<B> A;          //now typedef A

Unfortunately, I have yet find a way to make this work...