Skip to content

Use NULL and drop SHPLIB_NULLPTR #25

@schwehr

Description

@schwehr

SHPLIB_NULLPTR is defined in a number of places. e.g. shpopen.c

#ifdef __cplusplus
#define STATIC_CAST(type,x) static_cast<type>(x)
#define SHPLIB_NULLPTR nullptr
#else
#define STATIC_CAST(type,x) ((type)(x))
#define SHPLIB_NULLPTR NULL
#endif

This doesn't buy much as there is not mechanism in shapelib to build as C++. If the internals are ever converted to C++, then most of the NULLs should be converted to nullptr. The idea of having it both ways just adds complexity. Currently:

grep SHPLIB_NULLPTR *.c | wc -l
245

grep NULL *.c | grep -v SHPLIB_NULLPTR | wc -l
92

@rouault added the cast macros and SHPLIB_NULLPTR in 8ba2778. However, looking at gdal/ogr/ogrsf_frmts/shape, it doesn't currently look like shapelib is being built as C++ in sGDAL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions