[Development] Question about QCoreApplicationData::*_libpaths
Marc Mutz
marc.mutz at kdab.com
Tue Jan 19 10:07:43 CET 2016
On Tuesday 19 January 2016 00:41:35 Thiago Macieira wrote:
> On Monday 18 January 2016 23:11:14 Marc Mutz wrote:
> > QString foo() { return QStringLiteral("foo"); }
> > QString bar() { return Q3DeepCopy<QString>(QStringLiteral("foo")); }
> >
> > You will _never_ have the plugin-unloading problem with 'bar', only with
> > 'foo', and the reason is CoW: suggesting value semantics where there
> > aren't any.
>
> That doesn't mean types without CoW are immune from the problem. There are
> lots of discussion in the std mailing lists about constexpr data, so in the
> future a const std::string could potentially point to .rodata and thus be
> affected by this problem too.
But only _locally_. As soon as you copy the std::string, you're insulated from
that problem, unlike in CoW, where it can strike anywhere the string happens
to be copied to.
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts
More information about the Development
mailing list