[Development] Basing Qt Creator Coding Style on C++ Core Guidelines?

Marc Mutz marc.mutz at kdab.com
Mon Nov 21 10:15:24 CET 2016


On Monday 21 November 2016 09:37:38 Philippe wrote:
> > And you think Qt provides what MS added to std::vector here, in QVector?
> 
> Of course not. I just point the danger of dependencies on the usage of STL
> APIs, especially corner APIs.
> 
> I understand the #1 target of Qt is to behave the same on all platforms
> (as much as possible...). This is what users expects, at least.

These fixes mostly sound like they were enabled by - finally - implementing 
missing core C++11 features. We know we can't rely on MS to provide all C++11 
features atm, so we know not to rely on std::vector using 
std::move_if_noexcept, e.g., too. The aliasing thing, though, sounds like a 
genuine bug, and GCC's nth_element was buggy for some time, too.

OTOH, QList<double> does not at all behave the same on different platforms, 
either, in a much more fundamental way than any std::vector behaviour differs 
between platforms these days.

People make mistakes. The difference is that, in the STL, by way of a larger 
target audience, mistakes tend to be fewer than in Qt (looked at 
qtimageformats, lately?), and more easily fixed, because of largely no BC 
support, so it seems a bit skewed to throw one such STL bug on the table as an 
argument not to use the STL.

If Qt consistently did a better job at implementing such things, the world 
might be different. But looking at the Qt containers, and the Qt image format 
plugins, I'd much rather use an external library (STL, lib{jpeg,png,tiff,...) 
that everyone else also uses, than to reinvent the wheel and create bugs 
exclusive to Qt.

Thanks,
Marc

> Philippe
> 
> On Mon, 21 Nov 2016 09:04:59 +0100
> 
> Marc Mutz <marc.mutz at kdab.com> wrote:
> > On Sunday 20 November 2016 23:20:11 Philippe wrote:
> > > On Sun, 20 Nov 2016 19:49:09 +0100
> > > 
> > > Marc Mutz <marc.mutz at kdab.com> wrote:
> > > > I just intended to indicate that with 5.0, when we dropped QT_NO_STL,
> > > > but failed to take advantage of the STL containers,
> > > 
> > > ...good that STL containers were not used... Look at _this month_
> > > Visual Studio 2017 announcement:
> > > 
> > > <<<<
> > > std::vector has been overhauled for correctness and performance:
> > > aliasing during insertion/emplacement is now correctly handled as
> > > required by the Standard, the strong exception guarantee is now
> > > provided when required by the Standard via move_if_noexcept() and
> > > other logic, and
> > > insertion/emplacement perform fewer element operations.
> > > (https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes)
> > > 
> > > 
> > > Being the "standard library" does not mean "bug free and equal on all
> > > platforms". Dependencies with other libraries must be careful checked.
> > 
> > And you think Qt provides what MS added to std::vector here, in QVector?
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

-- 
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, C++ and OpenGL Experts



More information about the Development mailing list