Skip to content

Drop I length modifier from snprintf as it is unused #5089

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

Closed
wants to merge 1 commit into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Jan 15, 2020

Basing myself from the results of: https://gist.github.com/Girgias/b9a2b9926190630d433c84da0ef1b002 which indicate that the I (capital i) length modifier is unused, moreover it's not a C99 length modifier.

@Girgias
Copy link
Member Author

Girgias commented Jan 15, 2020

Test failures unrelated

@nikic
Copy link
Member

nikic commented Jan 17, 2020

I believe these are there for Windows compatibility. Just to confirm @cmb69, these modifiers are no longer used if people use standard PRIu64 and friends?

@cmb69
Copy link
Member

cmb69 commented Jan 17, 2020

Well, I don't see any Windows specific problem with removing support for that modifier, but wouldn't that possibly affect external extensions?

@Girgias
Copy link
Member Author

Girgias commented Jan 18, 2020

Well, I don't see any Windows specific problem with removing support for that modifier, but wouldn't that possibly affect external extensions?

Well as all internal changes it could affect external extensions but shouldn't those be using the relevant macros, instead of the I modifier.

@cmb69
Copy link
Member

cmb69 commented Jan 20, 2020

@Girgias yes, they should use the macros; I don't know if they do, though.

@Girgias
Copy link
Member Author

Girgias commented Jan 20, 2020

@Girgias yes, they should use the macros; I don't know if they do, though.

Meh, could always provide the grep regex so people can check but this is one of the discrepancies with the standard snprintf function. So I wouldn't expect that many people to use an unofficial one. But maybe need to check PECL extensions?

@cmb69
Copy link
Member

cmb69 commented Jan 20, 2020

@Girgias, thinking about it, that shouldn't be a real issue for a major version (if documented).

@Girgias
Copy link
Member Author

Girgias commented Jan 20, 2020

@Girgias, thinking about it, that shouldn't be a real issue for a major version (if documented).

Adding a note to UPGRADING.INTERNALS seemed obvious, not sure how I should formulate it however, maybe provide a link to the relevant macros? (which I'm not exactly sure where they are located)

@cmb69
Copy link
Member

cmb69 commented Jan 20, 2020

which I'm not exactly sure where they are located

php-src/Zend/zend_long.h

Lines 57 to 61 in 691880b

# define ZEND_LONG_FMT "%" PRId64
# define ZEND_ULONG_FMT "%" PRIu64
# define ZEND_XLONG_FMT "%" PRIx64
# define ZEND_LONG_FMT_SPEC PRId64
# define ZEND_ULONG_FMT_SPEC PRIu64

@Girgias
Copy link
Member Author

Girgias commented Jan 20, 2020

which I'm not exactly sure where they are located

php-src/Zend/zend_long.h

Lines 57 to 61 in 691880b

# define ZEND_LONG_FMT "%" PRId64
# define ZEND_ULONG_FMT "%" PRIu64
# define ZEND_XLONG_FMT "%" PRIx64
# define ZEND_LONG_FMT_SPEC PRId64
# define ZEND_ULONG_FMT_SPEC PRIu64

Thanks, so no objections for me to merge this with a note in UPGRADING.INTERNALS?

@php-pulls php-pulls closed this in aaa1f90 Jan 20, 2020
@Girgias Girgias deleted the drop-I-length-modifier branch January 20, 2020 22:09
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.

3 participants