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

Use %zd to output size variables; %td for pointer differences #17613

Open
khwilliamson opened this issue Mar 5, 2020 · 0 comments
Open

Use %zd to output size variables; %td for pointer differences #17613

khwilliamson opened this issue Mar 5, 2020 · 0 comments

Comments

@khwilliamson
Copy link
Contributor

Throughout the code when trying to output these things, various means have been used to try to get them to work without warnings on architectures with differing word sizes.

But for several releases, we have the 'z' length modifier that is appropriate for any siZe variables. So %zd and %zu can be used with any STRLEN, Size_t, or SSize_t variable, without having to do casts and using things like IVdf, which make the format harder to read.

Similarly there is the 't' length modifier for pTrdiff_t type expressions. Subtracting any two pointers creates an expression of this type according to the C standard. Again casts etc, can be eliminated and there should be no fear of exceeding limits.

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

1 participant