Skip to content

Conversation

@mizdebsk
Copy link
Member

Replace uses of std::ptrdiff_t with std::size_t for variables and parameters representing sizes and positions in string and span-like containers. This better reflects intent, avoids unnecessary signed/unsigned conversions, and aligns with common C++ conventions.

mizdebsk added 2 commits July 22, 2025 12:46
Replace uses of std::ptrdiff_t with std::size_t for variables and
parameters representing sizes and positions in string and span-like
containers.  This better reflects intent, avoids unnecessary
signed/unsigned conversions, and aligns with common C++ conventions.
@mkoncek
Copy link
Member

mkoncek commented Jul 23, 2025

I simply follow guidelines and a simple rule: use unsigned only when you want modulo arithmetic on overflow.

I adopted this approach in most of my projects.

@mizdebsk
Copy link
Member Author

I still think that size_t (or ssize_t) is the natural way of expressing sizes, not ptrdiff_t.
But if you disagree feel free to close the PR.

@mkoncek
Copy link
Member

mkoncek commented Aug 21, 2025

I want to keep everything signed.
ssize_t is a POSIX type, ptrdiff_t is a standard type (returned by the ssize functions.

@mkoncek mkoncek closed this Sep 17, 2025
@mizdebsk mizdebsk deleted the pr/27 branch September 17, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants