Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf8proc_ssize_t #103

Open
Matthew-Jemielity opened this issue Mar 9, 2017 · 1 comment
Open

utf8proc_ssize_t #103

Matthew-Jemielity opened this issue Mar 9, 2017 · 1 comment

Comments

@Matthew-Jemielity
Copy link

Hi,

If you're defining utf8proc_ssize_t as several different types according to platform, could you also have something like UTF8PROC_SSIZE_MIN, UTF8PROC_SSIZE_MAX, so it would be easier to have some safe conversion from size_t to it? This is mostly because of utf8proc_iterate using utf8proc_ssize_t strlen.

Regards,
Matt

@stevengj
Copy link
Member

stevengj commented Mar 9, 2017

Sure, we could define UTF8PROC_SSIZE_MAX ; a PR would be welcome.

utf8proc_ssize_t is a signed type that should be the same size as size_t on all known platforms.
So, the only time it would be not safe to convert would be if the length is ≥ 2^(n-1) on an n-bit platform. On a 64-bit platform this will never happen for any real string buffer.

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

No branches or pull requests

2 participants