Sunday, November 06, 2005

Copy&Waste programmers and compiler crash

Tried to build our database system with gcc 4.1 today. The first thing I noticed again was that the so called Copy&Waster programmers were active again. You don't know what a Copy&Waste programmer is? This is this sort of programmer that is too lazy to write something like a function body but instead takes a random file with similar code, copying all the errors of the original author and adding some new one. This sort of programmer is the same sort like the ones that implement almost all member functions of a C++ class within the class declaration resulting in two problems. The first one is that by the C++ standard member functions implemented within the class declaration are always inlined, which most likely fails for functions with thousands of lines of code. The second one is that it makes the class declaration complex and unreadable. This second problem combined with Copy&Waste programming then results in compiler errors like this:

myclass.hh:42: error: extra qualification 'myclass::' on member 'foo'

If the class declaration would have been clear from implementation code people would have noticed immediately that there is broken code. So, if you are a Copy&Waste programmer or you implement member functions within the class declaration please stop this _now_ unless you want to become non-replaceable in your company because you become famous for nobody wants to maintain your code.

After I fixed those stupid bugs I found that the compiler again crashes when trying to build the runtime engine. Will have to check tomorrow whether it is ok to show the preprocessed code in the public to do a proper gcc bug report.

No comments: