[Development] Dropping QT_NO_STL

Craig.Scott at csiro.au Craig.Scott at csiro.au
Wed Feb 8 02:12:58 CET 2012

From: "lars.knoll at nokia.com<mailto:lars.knoll at nokia.com>" <lars.knoll at nokia.com<mailto:lars.knoll at nokia.com>>
Date: 2 February 2012 4:49:45 AM AEDT
To: "thiago.macieira at intel.com<mailto:thiago.macieira at intel.com>" <thiago.macieira at intel.com<mailto:thiago.macieira at intel.com>>, "development at qt-project.org<mailto:development at qt-project.org>" <development at qt-project.org<mailto:development at qt-project.org>>
Subject: Re: [Development] Dropping QT_NO_STL (was: The future of QtAlgorithms)

Guess I should give my $0.02 as well ;-)

I'm perfectly fine with dropping -no-stl. As already explained in this
thread, we need STL (or a subset of it) anyways on embedded systems (due
to V8 and WebKit). On desktop systems -no-stl doesn't make any sense

Now the main point is about decent guidelines on where and how we use the
STL. Thiago had a pretty good first list and with a little tuning we might
get to a good policy here.

I think we need to be careful and try to avoid adding STL dependencies to
our public headers. Ideally, we get away with forward declarations of STL
types for interoperability.

In implementations, we can use whatever makes most sense from the set
agreed upon (with some care, so we keep our code readable and
maintainable). So if std::vector is better suited to a certain task than
QVector, let's just use it.


Sorry for commenting so late in the game on this thread, just catching up on email after being on leave. ;)

Before any STL types (particularly containers) are included in a public API, I would strongly recommend testing that these types can actually be exported as part of the interface on all platforms and supported compilers. I've got a sneaking suspicion that we've seen issues before (I think on Windows) where some specific STL containers were not exportable. Don't know if it is still a potential issue with the current set of compilers, but thought I'd mention it in case others have more concrete experience than me on this one. Also note that STL exception classes cannot be exported and caught reliably on all platforms (but I don't think anyone is talking here about adding STL exceptions to anything in the Qt API).

Dr Craig Scott
Computational Software Engineering Team Leader, CSIRO (CMIS)
Melbourne, Australia

More information about the Development mailing list