Archive for February 2007

Children respecting authority… what about authority respecting the children?

David Cameron said that

If children don’t learnt to respect authority at school how can we expect them to respect others when they grow up?

Maybe they’ll grow up to be politicians. Then they can continue the blatant disrespect for the voting public that is so common in today’s politics.

Respect is something you earn, and very importantly it shouldn’t be confused with fear. ASBOs, fingerprinting and CCTV cameras in schools, these aren’t examples of attempts at earning respect, they are trying to strike fear into school children.

So, David, why not stand up against the current trend of sneaking in a police state through the school gates? I am convinced that kids who are treated with respect will be better behaved and respect authority… they will also make better future politicians!

Seen in a presentation at work today…

$140+ Million

Yes, “dollar, one hundred and forty, plus, million”. Why do people think that it’s better to use symbols when it’s easier said in words?

Venting on C++

Lately I’ve used C++ for a tool I’ve been working on at the office. Here are some idiosyncrasies in the standard library that I’ve noticed:

I was expecting the following code to compile:

std::string f("hello.txt");
std::ifstream in_file(f);

But oh no! For some reason ifstream doesn’t have a constructor that accepts a standard C++ string. Instead I am forced to pass a const char * to the constructor, e.g.:

std::string f("hello.txt");
std::ifstream in_file(f.c_str());

I guess that’s an excellent exmple of standardisation-by-committee where one part of the committee doesn’t have a clue what the other one is doing. Pathetic, really!

Now more stuff on ifstream. One would hope that opening a non-existing file for reading would trigger some sort of exception, at the very least reading from a non-existing file shouldn’t succeed. Oh, but not so in the wonderful world of C++. The following code compiles and executes just fine even if the file (hello.txt) doesn’t exist:

std::ifstream inf("hello.txt");
std::string r;
inf >> r;
std::cout << r << std::endl;

r is unmodified by inf >> r;. Even more interestingly inf.eof() returns false. Interestingly inf.bad() returns false too. Luckily inf.good()i returns false too, so there is some way of finding out that not all is well with inf. It was also pointed out that evaluating inf itself, such as in if(inf) ..., also results in false.

Ah, now I feel much better :-)

  1. I can’t understand the reasonning behind having two methods, good() and bad() which aren’t each other’s opposites, their names certainly suggests they ought to be! It seems they are badly named, they should be called no_error_has_occured() and no_exceptional_failure_has_occured() respectively.[back]

Epilicious is in GNOME

GNOME bug #352082 has been closed and Epilicious is now to be found in GNOME SVN.