[Development] Setters: Passing by value or const reference?
thiago.macieira at intel.com
Wed Apr 25 13:47:35 CEST 2012
On quarta-feira, 25 de abril de 2012 12.12.22, Olivier Goffart wrote:
> The problem is that this code might be slightly slower in some cases in
> C++98 due to the additional copy if qMove is not supported by the
> compiler. But the idea is that C++11 is going to be more widely adopted
> really soon. (And it is much faster according to my benchmark
> http://paste.kde.org/463334 )
Performance on C++98 is not an argument. Performance on C++11 is. If your
change makes it faster on C++11, then I'd support it as-is. See also my blog
"The value of passing by value" which investigated another aspect of
passing by value.
However, I agree with you: it's too late to change it everywhere. Unless we do
it properly, it also has the potential to make things worse. I'd like to ask
you to find out where this is most important and do it now.
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
Intel Sweden AB - Registration Number: 556189-6027
Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/development/attachments/20120425/6b312308/attachment-0001.bin
More information about the Development