« May 19, 2006 | Main | May 25, 2006 »
Sunday, May 21, 2006
GCC: "error: extra qualification" Torpedo for C++ Programs in 4.1
Less than a day had elapsed since the release of ETSET 3.2 before it was torpedoed by a fanatical “purity of essence” enhancement foisted onto software developers worldwide by the C++ cabal at the GCC project. In every version of GCC from the get-go through 4.0, code like the following:class struggle { void struggle::propaganda(void) { } };compiled without so much as a warning, even in persnickety “-Wall” mode. But that was then, and this is now, and while the nugatory class qualification on "struggle::propaganda" is redundant since it's an in-line declaration within the class, it would seem to be just an example of specifying something you aren't required to in the interest of documentation—for example, when looking at a listing of a very long class declaration it reminds you of the name of the enclosing class. If you enter a search for:
gcc "error: extra qualification"into your favourite search engine, you'll find hundreds (more than 650, from the results I got) of messages documenting Open Source software projects which have been blown away by this “enhancement” of GCC—for what good? Some suggest that this has something to with namespaces in C++: perhaps some obscure incompatibility between the use of qualifiers for class names and namespaces requires blowing away decades of carefully-maintained code. But, should that be the case, it is simply more evidence that C++ has become a legacy language, like COBOL, in which we are obliged to maintain existing code and link to libraries, but which has become demonstrably unsuitable for new software development. Now, when this particular torpedo strikes your vessel beneath the waterline minutes before (or, worse, after) a delivery milestone, it's easy to remedy: simply remove the class qualifier from the inline function declaration: write “void propaganda(void)” instead of “void struggle::propaganda(void)”. But, when doing so, ask yourself that question so appropriate when dealing with figures in authority with fierce principles but scarce responsibility for the consequences of their actions, “Why, precisely, are we doing this?”.