|
Re: kabc question: msg#00398kde.devel.pim
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Dienstag, 28. Mai 2002 22:33 schrieb Cornelius Schumacher: > > Can't we introduce a startNoDetach() and an endNoDetach() function to > > prevent this kind of unnecessary copying from taking place? (or > > invent some other way to set multiple data fields at once without > > detach()ing) > > What about the attached patch? Ahh, obvious thing, of course. Could have thought of that myself. If you use something like void setEmail(KABC::Addressee a, QString mail) { a->insertEmail(mail); } void doSync(...) {.... setEmail(myAddressee, "test@xxxxxxxxxx"); setEmail( myAddressee, "test2@xxxxxxxxxxxxxxxxxx"); } doesn't the by-value call to setEmail create a copy of the myAddressee? (You see, my theoretical C++ knowledge is not so profound, it's just what I remember from reading Stroustrup some long time ago). If so, does a definition like void setEmail(KABC::Addressee &a, QString mail) {...} prevent this, since the Addressee is passed by reference? If so, with your patch one really needs to take care to use the &a in all methods! I still think your patch is the correct and clean solution to the problem, we just need to make sure developers understand that they need to pass by reference if they don't want to do some unnecessary stuff. Reinhold -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE88/82TqjEwhXvPN0RAif1AKCoMSNOTAYt1SQAwHya27vyXQtAaQCfT+os 6dyf07eMVG4H4JSGPJF1RIg= =NyWH -----END PGP SIGNATURE----- _______________________________________________ kde-pim mailing list kde-pim@xxxxxxxxxxxx http://mail.kde.org/mailman/listinfo/kde-pim kde-pim home page at http://pim.kde.org/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: kabc question: 00398, Cornelius Schumacher |
|---|---|
| Next by Date: | kde-organizer, kde-pilot?: 00398, Matthew Dougherty |
| Previous by Thread: | Re: kabc questioni: 00398, Cornelius Schumacher |
| Next by Thread: | Re: kabc question: 00398, Cornelius Schumacher |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |