[gdal-dev] VS 2013 and list initialization

Kurt Schwehr schwehr at gmail.com
Tue Dec 19 15:12:26 PST 2017


+1 for dropping MSVC2013

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

https://trac.osgeo.org/gdal/changeset/41076

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

On Sat, Dec 16, 2017 at 11:45 AM, Even Rouault <even.rouault at spatialys.com>
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
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
--
http://schwehr.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171219/27f9283f/attachment.html>


More information about the gdal-dev mailing list