[Uml-devel] CVS update & problem
Thomas Baumgart
thb at net-bembel.de
Wed Jul 17 08:24:07 UTC 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
on Wednesday 17 July 2002 13:46, Paul Hensgen wrote:
> Hi guys,
>
> Updated cvs and it is abit different with kdevelop 2.1.2 to the other
> version I was using.
>
> KDevelop no longer make a uml binary but something like uml-i386-linux or
> something like that. This means program won't load from menu atm.
>
> CVS has again got a stale lock on it. I have contacted sourceforge and
> waiting for them to remove it. I thought they had fixed the problem with
> vi.
I just had a look and noticed that you were able to checkin some changes to
sourceforge. I noticed, that Paul changed the list comparison in
bool UMLOperation::operator==( UMLOperation & rhs )
to
if( &m_List != &(rhs.m_List) )
In my opinion, this is not correct, as it compares the addresses of the list,
not their contents. To proof this, I analyzed the QT source at that point and
wrote the following little test program which I want to share with you:
#include <qlist.h>
#include <iostream>
int main()
{
QList<int> a;
QList<int> b;
bool res;
a = b;
res = a == b;
cout << "1) a == b returns " << res << endl;
res = &a == &b;
cout << "2) &a == &b returns " << res << endl;
res = !(a == b);
cout << "3) !(a == b) returns " << res << endl;
res = &a != &b;
cout << "4) &a != &b returns " << res << endl;
return 0;
}
The results are:
1) a == b returns 1
2) &a == &b returns 0
3) !(a == b) returns 0
4) &a != &b returns 1
As one can see, the same two lists might have the same contents but different
addresses (as they are stored with different objects).
I would assume, that 3) is the correct result not 4).
Or am I missing something here? Please tell me if I am completely wrong,
because then I have to consider to go back to the books on C++ again.
- --
Regards
Thomas Baumgart
home: thb at net-bembel.de WWW: http://www.net-bembel.de/
Check the KMyMoney2 open source project at http://kmymoney2.sf.net/
public key available at http//www.keyserver.net under thb at net-bembel.de
GPG-FP: E55E D592 F45F 116B 8429 4F99 9C59 DB40 B75D D3BA
- -------------------------------------------------------------
A crash turns an expensive computer into a simple stone!
- -------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Visit S.E.S.A. AG at http://www.sesa.de/
iD8DBQE9NYwFBEBpXFzzndgRAtWUAJ9voW4EF0mcwQGyVCtpgWz4hHsMJwCeIl5a
0BiFkBNWrxJJk/l8PnHzEY0=
=GpF1
-----END PGP SIGNATURE-----
More information about the umbrello-devel
mailing list