GeniusOfEvil’s Blog

It is a sin to believe evil of others, but it is seldom a mistake.

Archive for the ‘Cpp’ Category

Exception handling in constructor’s initialization list

There are some aspects of C++ syntax that still amaze me… The syntax for catching an exception in an initialization list is one of them.It’s totally awkward

class MyClass {
     try : <initialization list>
     { }
     catch ( ... ) { 

But even if you catch the exception, you are pretty much screw because it cannot be guaranteed that object being created is in a valid state.There’s nothing much you can do besides rethrowing the exception.


Written by Jarek Przygódzki

April 1, 2009 at 2:43 pm

Posted in C++, Cpp, Programing

Tagged with , ,

Mixing stdio with iostream

leave a comment »

When mixing C stdio and C++ iostream synchronization problems can occur because the two libraries use different buffering strategies. This seems a major drawback since mixing C++ code with C libraries (that uses stdio) is a very common practice. Luckily, all we have to do to avoid these problems is to call function


Written by Jarek Przygódzki

March 26, 2009 at 9:43 am

Posted in C++, Cpp, Programing

Tagged with ,