Purge Geometry pointer aliases?
Martin Davis
mtnclimb at gmail.com
Thu Jan 9 15:32:54 PST 2025
There seems to be agreement that purging pointer aliases is A Good Thing To
Do.
Much of the usage in the test suite, with fewer occurrences present in the
main code base. So this makes it easier to clean up the main code base,
which is the priority.
Not backporting the changes may make it harder in the future to port bug
fixes and improvements to older major versions. We don't promise ABI
stability for the C++ API, so I'm not sure whether this is a real concern?
On Thu, Jan 9, 2025 at 5:52 AM Daniel Baston <dbaston at gmail.com> wrote:
> 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/4dde80fc/attachment.htm>
More information about the geos-devel
mailing list