[Development] Q_COMPILER_RANGE_FOR not supported by/defined for VS2012 and VS2013 ?

Marc Mutz marc.mutz at kdab.com
Wed Mar 2 22:38:03 CET 2016


On Wednesday 02 March 2016 17:59:05 Thiago Macieira wrote:
> On quarta-feira, 2 de março de 2016 08:52:10 PST Koehne Kai wrote:
> > Fair enough, I didn't want to imply otherwise. But I read your statement
> > as 'don't dare to use range-for unless you test with MSVC yourself',
> > which is IMO  too much to ask for.
> > 
> > The rule of thumb I got is "use ranged-for with curly brackets". Doesn't
> > this cover it?
> 
> Maybe. Who knows, the parser is buggy!

Having introduced the most range-fors into Qt of all developers over the last 
weeks, I have come across only one issue, and it's the one from the bug 
report:

   for ( ... : ... )
        do { ... } while

As in, e.g.,

   for (... : ...)
       QCOMPARE(..., ...)

I think it's safe to say that range-for works as expected in so vast a 
majority of cases that the CI can be used to catch the rest. Without violating 
the Qt Code Formatting Guidelines and putting {} around each range-for loop 
body.

Thanks,
Marc

-- 
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