Ugh. constexpr would be nice to get started on, but yes, many of the wins come in more with C++14 and C++17.
https://ci.appveyor.com/project/OSGeo/gdal/build/1.0.4152/job/y7fusq8a4lopxpni Environment: platform=x86, VSCOMNTOOLS=$(VS120COMNTOOLS), SDK=release-1800, MSVC_VER=1800 cpl_error.cpp c:\projects\gdal\gdal\port\cpl_conv.cpp(343) : error C2144: syntax error : 'char' should be preceded by ';' c:\projects\gdal\gdal\port\cpl_conv.cpp(343) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\projects\gdal\gdal\port\cpl_conv.cpp(344) : error C2144: syntax error : 'char' should be preceded by ';' c:\projects\gdal\gdal\port\cpl_conv.cpp(344) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\projects\gdal\gdal\port\cpl_conv.cpp(344) : error C2086: 'int constexpr' : redefinition c:\projects\gdal\gdal\port\cpl_conv.cpp(343) : see declaration of 'constexpr' c:\projects\gdal\gdal\port\cpl_conv.cpp(669) : error C2146: syntax error : missing ';' before identifier 'size_t' c:\projects\gdal\gdal\port\cpl_conv.cpp(669) : error C2146: syntax error : missing ';' before identifier 'nChunkSize' c:\projects\gdal\gdal\port\cpl_conv.cpp(669) : error C2275: 'size_t' : illegal use of this type as an expression c:\projects\gdal\gdal\port\predefined c++ types (compiler internal)(19) : see declaration of 'size_t' c:\projects\gdal\gdal\port\cpl_conv.cpp(669) : error C2065: 'nChunkSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(670) : error C2065: 'nChunkSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(682) : error C2065: 'nChunkSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(691) : error C2065: 'nChunkSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(702) : error C2065: 'nChunkSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(702) : error C2660: 'VSIFReadL' : function does not take 3 arguments c:\projects\gdal\gdal\port\cpl_conv.cpp(709) : error C2065: 'nChunkSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(760) : error C2065: 'nChunkSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(1987) : error C2144: syntax error : 'char' should be preceded by ';' c:\projects\gdal\gdal\port\cpl_conv.cpp(1987) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\projects\gdal\gdal\port\cpl_conv.cpp(1987) : error C2086: 'int constexpr' : redefinition c:\projects\gdal\gdal\port\cpl_conv.cpp(343) : see declaration of 'constexpr' c:\projects\gdal\gdal\port\cpl_conv.cpp(1988) : error C2144: syntax error : 'double' should be preceded by ';' c:\projects\gdal\gdal\port\cpl_conv.cpp(1988) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\projects\gdal\gdal\port\cpl_conv.cpp(1988) : error C2086: 'int constexpr' : redefinition c:\projects\gdal\gdal\port\cpl_conv.cpp(343) : see declaration of 'constexpr' c:\projects\gdal\gdal\port\cpl_conv.cpp(2608) : error C2146: syntax error : missing ';' before identifier 'size_t' c:\projects\gdal\gdal\port\cpl_conv.cpp(2608) : error C2146: syntax error : missing ';' before identifier 'nBufferSize' c:\projects\gdal\gdal\port\cpl_conv.cpp(2608) : error C2275: 'size_t' : illegal use of this type as an expression c:\projects\gdal\gdal\port\predefined c++ types (compiler internal)(19) : see declaration of 'size_t' c:\projects\gdal\gdal\port\cpl_conv.cpp(2608) : error C2065: 'nBufferSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(2609) : error C2065: 'nBufferSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(2624) : error C2065: 'nBufferSize' : undeclared identifier c:\projects\gdal\gdal\port\cpl_conv.cpp(2631) : error C2065: 'nBufferSize' : undeclared identifier cpl_string.cpp cplstring.cpp On Fri, Dec 15, 2017 at 9:22 AM, Even Rouault <[email protected]> wrote: > Kurt, > > > > It doesn't look like constexpr is available in VS2013 (at least not in all > sub-versions of it): > > https://stackoverflow.com/questions/20264644/constexpr- > not-compiling-in-vc2013 > > > > Personnally, I don't see it as a super needed feature that would justify > dropping VS2013 support. Especially in the below use cases where it doesn't > bring anything more than const, except more characters to type/read. I'd > bet any sane compiler in -O2 will compile the source to the same machine > code in all those cases > > > > Even > > > > On vendredi 15 décembre 2017 07:04:23 CET you wrote: > > > Author: goatbar > > > Date: 2017-12-15 07:04:23 -0800 (Fri, 15 Dec 2017) > > > New Revision: 41044 > > > > > > Modified: > > > trunk/gdal/port/cpl_conv.cpp > > > Log: > > > const -> constexpr for things known at compile time in cpl_conv.cpp > > > > > > > > > > > > Modified: trunk/gdal/port/cpl_conv.cpp > > > =================================================================== > > > --- trunk/gdal/port/cpl_conv.cpp 2017-12-15 14:37:43 UTC (rev 41043) > > > +++ trunk/gdal/port/cpl_conv.cpp 2017-12-15 15:04:23 UTC (rev 41044) > > > @@ -340,8 +340,8 @@ > > > /*********************************************************** > *************/ > > > > > > // ASCII characters. > > > -static const char knLF = 10; > > > -static const char knCR = 13; > > > +constexpr char knLF = 10; > > > +constexpr char knCR = 13; > > > > > > /** > > > * Reads in at most one less than nBufferSize characters from the fp > > > @@ -666,7 +666,7 @@ > > > /* the line. */ > > > /* -------------------------------------------------------------------- > */ > > > char *pszRLBuffer = nullptr; > > > - const size_t nChunkSize = 40; > > > + constexpr size_t nChunkSize = 40; > > > char szChunk[nChunkSize] = {}; > > > size_t nChunkBytesRead = 0; > > > int nBufLength = 0; > > > @@ -1984,8 +1984,8 @@ > > > /* CPLDMSToDec() */ > > > /*********************************************************** > *************/ > > > > > > -static const char *sym = "NnEeSsWw"; > > > -static const double vm[] = { 1.0, 0.0166666666667, 0.00027777778 }; > > > +constexpr char sym[] = "NnEeSsWw"; > > > +constexpr double vm[] = { 1.0, 0.0166666666667, 0.00027777778 }; > > > > > > /** CPLDMSToDec */ > > > double CPLDMSToDec( const char *is ) > > > @@ -2605,7 +2605,7 @@ > > > /* -------------------------------------------------------------------- > */ > > > /* Prepare buffer. */ > > > /* -------------------------------------------------------------------- > */ > > > - const size_t nBufferSize = 1024 * 1024; > > > + constexpr size_t nBufferSize = 1024 * 1024; > > > GByte *pabyBuffer = static_cast<GByte > > > *>(VSI_MALLOC_VERBOSE(nBufferSize)); if( pabyBuffer == nullptr ) > > > { > > > > > > _______________________________________________ > > > gdal-commits mailing list > > > [email protected] > > > https://lists.osgeo.org/mailman/listinfo/gdal-commits > > > > > > -- > > Spatialys - Geospatial professional services > > http://www.spatialys.com > -- -- http://schwehr.org
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
