Ok after having seen the numerous bugs in the compiler itself, I
thought of taking notes on the kind of
crap I am facing. For obvious legal reasons I cannot copy paste the
code or mention the classes that
have been effected, but I will give some example code here.
This is VERY interesting bug (or limitation :D) that I faced
while looking through the code of a very famous game engine.
Some confiiguration details:
compiler: VC++ 7.1 aka Visual Studio .NET 2003
OS: Windows XP SP2
Other sw: Firefox, Gaim
:D
Now if you take a look at the following code extract:
//Header file : CBuggyCompiler.h
class CBuggyCompiler
{
friend ostream & operator << (ostream
& os, const
CBuggyCompiler & mySillyType)
{
/* Whatever code here */
}
void Wasted()
{
std::cout << this;
}
}
//Implementation file : CBuggyCompiler.cpp
...
This gives a compilation error. Something like "No appropriate
redirection operator << found for type int
in class CBuggyCompiler"
What baffled me was that this was an error that did not occur in Visual
C++ 6.
However it was later that I learnt that even this version of the
compiler had
posed similar problems. This particular problem could be fixed by
installing
one of those innumerable service packs on Visual C++ 6.
As of this writing I could not find a service pack that could fix
this problem. I
guess it is about to come up or something like that. I hope that there
is a
service pack out there and it was just me that could not find that
service
pack. So this is how you could fix this bug (read: bug in compiler)
The trick was to seperate the definition from the declaration.
Thus your code would be
like this:
//Header file CBuggyCompiler.h
class CBuggyCompiler;
ostream & operator << (ostream & os, const CBuggyCompiler
& mySillyType);
class CBuggyCompiler
{
friend ostream &
operator << (ostream & os, const
CBuggyCompiler & mySillyType)
{
...
}
void Wasted()
{
std::cout << this;
}
}
This fixed the error. Well this seems to fix the error.
I tried alot of the other things and then I figured out that this could
be reason.
If you have any suggestions/solutions please send them to

Copyrights CyraX/Chaitanya
http://students.iiit.net/~cyrax
