[gdal-dev] VS 2013 and list initialization

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] VS 2013 and list initialization

Even Rouault-2

Hi,

 

While writing a new driver, I've experimented a bit with C++11 default non-static data

member initialization.

 

Unfortunately the following

 

class C

{

double m_adfGeotransform[6]{0,1,0,0,0,1}; // breaks VS 2013

};

 

which works with conformant C+11 compilers breaks on VS 2013 with

 

error C2797:

list initialization inside member initializer list or non-static data member initializer is not implemented

 

Similary, double m_adfGeotransform[6] = {0,1,0,0,0,1} also breaks.

 

This is discussed in

https://stackoverflow.com/questions/27741521/error-c2797-list-initialization-inside-member-initializer-list

https://blogs.msdn.microsoft.com/vcblog/2014/08/19/the-future-of-non-static-data-member-initialization/

The issue has been solved in VS2015

 

A workaround is to use std::array and non-static data member initialization with equal initializer and explicit type

in front of initialized values

 

class C

{

std::array<double,6> m_adfGeotransform = std::array<double,6>{{0,1,0,0,0,1}}; // OK VS 2013

};

 

(For the same reason as above, direct initialization

std::array<double,6> m_adfGeotransform{{0,1,0,0,0,1}}; // breaks VS 2013

)

 

Given this and other issues found, we might revisit at some point supporting VS2013. Would

still be good to try to have it for GDAL 2.3, but we can perhaps drop it afterwards.

 

 

Even

 

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: VS 2013 and list initialization

Kurt Schwehr-2
+1 for dropping MSVC2013

With Even's warning, I still ran head long into the booby trap...


And as I recently learned about C99 support, I just get more sad.

On Sat, Dec 16, 2017 at 11:45 AM, Even Rouault <[hidden email]> wrote:

Hi,

 

While writing a new driver, I've experimented a bit with C++11 default non-static data

member initialization.

 

Unfortunately the following

 

class C

{

double m_adfGeotransform[6]{0,1,0,0,0,1}; // breaks VS 2013

};

 

which works with conformant C+11 compilers breaks on VS 2013 with

 

error C2797:

list initialization inside member initializer list or non-static data member initializer is not implemented

 

Similary, double m_adfGeotransform[6] = {0,1,0,0,0,1} also breaks.

 

This is discussed in

https://stackoverflow.com/questions/27741521/error-c2797-list-initialization-inside-member-initializer-list

https://blogs.msdn.microsoft.com/vcblog/2014/08/19/the-future-of-non-static-data-member-initialization/

The issue has been solved in VS2015

 

A workaround is to use std::array and non-static data member initialization with equal initializer and explicit type

in front of initialized values

 

class C

{

std::array<double,6> m_adfGeotransform = std::array<double,6>{{0,1,0,0,0,1}}; // OK VS 2013

};

 

(For the same reason as above, direct initialization

std::array<double,6> m_adfGeotransform{{0,1,0,0,0,1}}; // breaks VS 2013

)

 

Given this and other issues found, we might revisit at some point supporting VS2013. Would

still be good to try to have it for GDAL 2.3, but we can perhaps drop it afterwards.

 

 

Even

 

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



--

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev