[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: [MAJOR BUG] g++ 2.95.x generates invalid code for KDE 3.3.0
From: Matthias Kretz <kretz () kde ! org>
Date: 2004-09-17 22:17:18
Message-ID: 200409180017.19898.kretz () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
And here comes a workaround (guess what, it's ugly)
What it does is to delay the code in the ctors until the whole object is
constructed. For completeness I move the code in SocketBase, but that's not
really needed.
--
C'ya
Matthias
________________________________________________________
Matthias Kretz (Germany) <><
http://Vir.homeip.net/
MatthiasKretz@gmx.net, kretz@kde.org,
Matthias.Kretz@urz.uni-heidelberg.de
["test.cpp" (text/x-c++src)]
#include <unistd.h>
class SocketBase
{
public:
int *last_i;
SocketBase()
: last_i(new int)
{
}
void workaroundctor()
{
write( 1, "SocketBase\n", 11 );
*last_i = 0;
}
virtual void otherfunc(int i)
{
*last_i = '0';
}
virtual void basefunc(int i)
{
otherfunc(i);
}
};
class ActiveBase: virtual public SocketBase
{
public:
ActiveBase()
{
}
void workaroundctor()
{
SocketBase::workaroundctor();
write( 1, "ActiveBase\n", 11 );
basefunc( 2 );
}
virtual void otherfunc(int i)
{
*last_i = 'a' + i;
}
};
class StreamSocket: public ActiveBase
{
int i3;
public:
StreamSocket()
{
workaroundctor();
}
void workaroundctor()
{
ActiveBase::workaroundctor();
write( 1, "StreamSocket\n", 13 );
}
};
main()
{
StreamSocket c;
write( 1, c.last_i, sizeof( *c.last_i ) );
write( 1, "\n", 1 );
}
[Attachment #6 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic