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

Thiago Macieira thiago.macieira at intel.com
Mon Feb 29 20:12:30 CET 2016


On segunda-feira, 29 de fevereiro de 2016 19:40:07 PST Michael Möllney wrote:
> >> So is it an error in
> >> https://github.com/qtproject/qtbase/blob/5.7/src/corelib/global/qcompiler
> >> det ection.h#L917 ?
> > 
> > It's intentional. It's buggy in previous versions, so the #define is not
> > present.
> 
> Wow, thank you for this info.
> Do you have a link at hand, where this is shown?

I thought I had added it to qcompilerdetection.h, but apparently didn't. 
Searching in MS connect is awful (only Apple's bugtracking is worse), so no, I 
don't have the link handy.

> Is there a code pattern that's producing buggy code?

Whatever is in tst_compiler.cpp. It happens when you don't use braces with the 
statement.

> > The deal for Qt's own code is that the submitter using ranged for must
> > test
> > with at least one version of the MS compiler before hitting the Stage
> > button.
> Sorry, I could not find this info.
> 
> Sounds like a strong burden for developers coming from the gcc platform
> committing patches to Qt
> that they have to test on VS2012 first.

Yes. Tough luck. The CI is not for checking that your code compiles. You must 
have done that before you even pushed.

If you don't want to be forced to test this specific thing on VS2012, don't use 
range-fors.

> Should this be mentioned in
> https://wiki.qt.io/Coding_Conventions#Conventions_for_C.2B.2B11_usage

Yes.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list