Opened 8 years ago
Closed 5 years ago
#6192 closed task (wontfix)
Switch all C++ usages of ABS, MIN, and MAX macros to std::{abs,min,max}
Reported by: | Kurt Schwehr | Owned by: | Kurt Schwehr |
---|---|---|---|
Priority: | normal | Milestone: | closed_because_of_github_migration |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | macros |
Cc: |
Description
In the vain of (almost) always preferring functions to macros, GDAL should use the std:: version for C++ code.
Examples of converting: r31275, r31273 + r31274
There are still C usages:
find . -name \*.c | xargs egrep -l '[^a-zA-Z_](MIN|MAX|ABS)[^a-zA-Z_]' | egrep -v 'lib(csf|jpeg|png|geotiff)|giflib|degrib18' ./ogr/ogrsf_frmts/dgn/dgndump.c ./ogr/ogrsf_frmts/avc/avc_bin.c ./ogr/ogrsf_frmts/avc/avc_binwr.c ./ogr/ogrsf_frmts/avc/avc_rawbin.c ./ogr/ogrsf_frmts/avc/avc_e00gen.c ./ogr/ogrsf_frmts/avc/avc_e00parse.c ./ogr/ogrsf_frmts/shape/shpopen.c ./ogr/osr_cs_wkt.c ./frmts/nitf/nitffile.c ./frmts/nitf/nitfimage.c ./frmts/gxf/gxfopen.c ./frmts/dted/dted_ptstream.c ./frmts/dted/dted_api.c ./frmts/dted/dted_create.c ./apps/gdaltindex.c
Can we convert any of these files to C++?
Change History (4)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
r31276 should fix the mac build. integer abs templates are in cstdlib, whereas cmath provides the floating point templates.
comment:3 by , 8 years ago
avc and shapelib have "upstream" projects (although rather inactive those last years). Other files are pretty much internal to GDAL. Although if we kill all C files, I'm not sure how we're going to verify that the public headers can still be included from a pure C file, as we don't have any .c files in autotest/cpp anymore. Might be good to add at least one.
comment:4 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.
http://en.cppreference.com/w/cpp/numeric/math/abs says long long abs( long long n ); is C++11.
Confusion follows...