C++ idioms

I'm more from a C++ background so it is quite confusing for me to see that you mix C and C++ style quite often. I think it would be nice to stick to one style.

Also with the c++11/gnu0x flag set during compilation we should use new language features when they make the code more readible