[gdal-dev] std::numeric_limits<int64_t>::min() vs LLONG_MIN

Even Rouault even.rouault at spatialys.com
Sun Dec 18 13:59:56 PST 2022


Paul,

I've queued your proposed fix in pull request 
https://github.com/OSGeo/gdal/pull/6943

Even

Le 18/12/2022 à 22:18, Paul Meems a écrit :
> I made the brackets bold. That seems to result in the *
> Only ( and ) are needed, no *.
>
> Regards,
> Paul
>
> Op zo 18 dec. 2022 18:39 schreef Andrew C Aitchison 
> <andrew at aitchison.me.uk>:
>
>     On Sun, 18 Dec 2022, Paul Meems wrote:
>
>     > Thanks all for your suggestions.
>     > I did some more research and it seems to be an issue with the
>     preprocessor
>     > on Windows.
>     >
>     > Adding some brackets solves the issue as well:
>     > // old
>     > constexpr int64_t GDAL_PAM_DEFAULT_NODATA_VALUE_INT64 =
>     > std::numeric_limits<int64_t>::min();
>     > constexpr uint64_tGDAL_PAM_DEFAULT_NODATA_VALUE_UINT64=
>     > std::numeric_limits<uint64_t>::max();
>     > // new:
>     > constexpr int64_t GDAL_PAM_DEFAULT_NODATA_VALUE_INT64 =*(*
>     > std::numeric_limits<int64_t>::min*)*();
>     > constexpr uint64_t GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64 =*(*
>     > std::numeric_limits<uint64_t>::max*)*();
>
>     Do you mean to add *(* and *)* or just ( and ) ?
>
>     > I'm not sure what the impact would be for non-windows compilers,
>     but if no
>     > impact could this be changed in the code?
>     >
>     > Thanks,
>     >
>     > Paul Meems
>     >
>     >
>     > Op za 17 dec. 2022 om 07:10 schreef <dg0yt at darc.de>:
>     >
>     >> I'm not using MSVC, so this is a guess:
>     >> Are you including 'windows.h' without 'NOMINMAX' being defined?
>     >> Then you will get macros which interfere with the limits code.
>     >>
>     >> Regards, Kai.
>     >>
>     >>> Paul Meems <bontepaarden at gmail.com> hat am 17.12.2022 00:46 CET
>     >> geschrieben:
>     >>>
>     >>>
>     >>> Thanks, Kurt for your response.
>     >>>
>     >>> I'm getting a very vague error message:
>     >>> E0040 expected an identifier.
>     >>>
>     >>>
>     >>>  Regards,
>     >>>
>     >>> Paul
>     >>>
>     >>>
>     >>> Op za 17 dec. 2022 om 00:40 schreef Kurt Schwehr
>     <schwehr at gmail.com>:
>     >>>> What exact error are you getting?
>     >>>>
>     >>>>
>     >>>> On Fri, Dec 16, 2022 at 3:31 PM Paul Meems
>     <bontepaarden at gmail.com>
>     >> wrote:
>     >>>>> Hello List,
>     >>>>>
>     >>>>> We're trying to update MapWinGIS which is using the GDAL
>     libraries
>     >> from gisinternals.com <http://gisinternals.com>
>     (http://gisinternals.com)
>     >>>>> Currently, we use the stable daily of December
>     >> 9: release-1928-gdal-3-5-mapserver-8-0
>     >>>>>
>     >>>>> I'm using VS2019 (on Windows) to compile and I'm having
>     issues with
>     >> two lines in gdal_pam.h, around line 215.
>     >>>>> We need to change these two lines:
>     >>>>>
>     >>>>>   * constexpr int64_t GDAL_PAM_DEFAULT_NODATA_VALUE_INT64 =
>     >> std::numeric_limits<int64_t>::min();
>     >>>>>   * constexpr uint64_t GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64 =
>     >> std::numeric_limits<uint64_t>::max();
>     >>>>> To
>     >>>>>   * constexpr int64_t GDAL_PAM_DEFAULT_NODATA_VALUE_INT64 =
>     >> LLONG_MIN;
>     >>>>>   * constexpr uint64_t GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64 =
>     >> LLONG_MAX;
>     >>>>> I prefer not to alter the files from gisinternals.com
>     <http://gisinternals.com> (
>     >> http://gisinternals.com). Is this what we can solve on our end?
>     >>>>> Is it related to the C++ version? We use these:
>     >>>>>
>     >>>>>   * ISO C++14 Standard (/std:c++14)
>     >>>>>   * ISO C11 Standard (/std:c11)
>     >>>>> Thanks for any advice.
>     >>>>>
>     >>>>> Paul Meems
>     >>>>>
>     >>>>> _______________________________________________
>     >>>>>  gdal-dev mailing list
>     >>>>> gdal-dev at lists.osgeo.org
>     >>>>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>     >>>>>
>     >>> _______________________________________________
>     >>> gdal-dev mailing list
>     >>> gdal-dev at lists.osgeo.org
>     >>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>     >> _______________________________________________
>     >> gdal-dev mailing list
>     >> gdal-dev at lists.osgeo.org
>     >> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>     >>
>     >
>
>     -- 
>     Andrew C. Aitchison                      Kendal, UK
>     andrew at aitchison.me.uk
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221218/34d48096/attachment-0001.htm>


More information about the gdal-dev mailing list