On Wed, Apr 01, 2015 at 10:35:20AM +1100, Hamish Moffatt wrote: > On 25/03/15 05:16, Thiago Macieira wrote: > > On Tuesday 24 March 2015 17:29:39 Gunnar Roth wrote: > >> Does anybody know why QT_STRICT_ITERATORS is not standard? > > First, because it breaks existing, legitimate code that mixes const and non- > > const iterators properly (yes, there are legitimate ways to do it). > > > > Second, because it's binary incompatible in QVector. The iterator for non- > > strict QVector is a pointer; in strict mode, it's a class. So if you have > > the > > iterator in your function parameters or template parameters, it will not be > > compatible if you turn it on or off. > > > > However, I do recommend you turn it on in your own code, along with > > QT_NO_CAST_FROM_ASCII and QT_NO_CAST_TO_ASCII. > > > > Thanks for the tip. I just enabled QT_STRICT_ITERATORS and fixed a few > bugs. I was bitten by comparison a const_iterator with a non-const end > after upgrading to Qt 5.4 (the same code worked in 4.8). > > What's the benefit of QT_NO_CAST_FROM_ASCII though? I tried, but gave up > after I saw the first million compile errors.
Note there's also QT_RESTRICTED_CAST_FROM_ASCII that catches less errors but is also less intrusive on your sources. Given a choice, I'd prefer QT_NO_CAST_FROM_ASCII, though. Andre' _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest