Purge Geometry pointer aliases?

Daniel Baston dbaston at gmail.com
Thu Jan 9 05:52:04 PST 2025


Hi Martin,

I avoid the typedefs for the same reasons you listed, but they seem to be
rarely used outside of unit tests (grep shows 97 lines with "Ptr" under
"src" and 825 lines under "tests"). I'm not sure if a purge is the highest
priority for improving the test suite, but am not opposed if others want to
take that on. I would not be in favor of backporting this type of change,
which would break the API in a minor release while offering no benefit to
users.

Dan

On Wed, Jan 8, 2025 at 7:16 PM Martin Davis <mtnclimb at gmail.com> wrote:

> The GEOS codebase has several typedefs called GeometryPtr and GeomPtr.
> They are aliases for a mixture of Geometry * and std::unique_Ptr<Geometry>.
> I'm thinking it's a good thing to purge them from the codebase in favour of
> explicit type signatures, because:
>
> - it's highly confusing that they can be aliases for different things
> - it's complicated that they are defined in multiple places
> - it can be hard to see what they represent
> - they don't save much typing in the case of Geometry*, and using auto can
> simplify other uses
>
> This was discussed a while back.  The general feeling was that it's better
> to use explicit types.  Is this still the consensus?
>
> Some notes on the process:
> - I expect this will be done in multiple passes, to fit work schedules.
> Will start with the least intrusive changes
> - when this is done, it needs to be backported so that subsequent
> backports don't collide with unchanged code.
> - If older versions use the aliases in dead code, it may not be removed,
> just patched to ensure it still compiles (i.e. by leaving the typedefs in
> place)
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20250109/93a95f80/attachment-0001.htm>


More information about the geos-devel mailing list