[Development] Setters: Passing by value or const reference?
Marc Mutz
marc.mutz at kdab.com
Sun Jun 24 09:52:10 CEST 2012
On Wednesday April 25 2012, Olivier Goffart wrote:
> > > We could implement a move setter (Foo::setText(QString&&)). But that
> > > would
> > > mean duplication, and it could not be inline (access to d_ptr) so
> > > binary incompatibility between Qt compiled with or without C++11.
> >
> > The rvalue overloads could only be used by a C++11 compiler, and it would
> > be natural for a C++11 app to require a C++11-compiled Qt.
>
> Not really...
> On linux, if the dirstribution provides a qt compiled without C++11, i
> still want to be able to use C++11 it on my project.
> C++11 is still (unfortunatelly) not the default to build Qt on linux.
A late-entry data point:
libstdc++'s std::list is binary incompatible between -std=c++11
and -std=c++98, because it adds a _M_size member.
It's the most stupid change I can imagine, but it apparently means that the
GCC devs don't shoot for BC between C++11- and C++98-compiled code. I guess
that, at least for GCC users, it might therefore actually be a boon if a Qt
compiled in C++11 mode was incompatible with a Qt compiled in C++98 mode at,
say, the linker level, lest they ran into such hidden BiC issues unawares.
Thanks,
Marc
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
More information about the Development
mailing list