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

Incorrect padding on hexadecimal formatting of integers #50621

Open
coder543 opened this issue May 10, 2018 · 3 comments
Open

Incorrect padding on hexadecimal formatting of integers #50621

coder543 opened this issue May 10, 2018 · 3 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@coder543
Copy link

The behavior in #48978 does not seem correct.

Playground link

The number of digits in the output doesn't seem to match the requested amount of padding.

@coder543
Copy link
Author

coder543 commented May 10, 2018

It appears to be caused by the leading 0x, as demonstrated by it working in what I consider the intuitively correct fashion on this playground.

Maybe this is expected behavior to some people, but it certainly isn't what I was expecting.

@cuviper
Copy link
Member

cuviper commented May 10, 2018

You get the same thing as printing numbers directly with {:#08x}, which also does count the 0x.

@fpgaminer
Copy link

Yes, this is the previous behavior when printing numbers directly. It includes the prefix as part of the length of the formatted number. It's odd behavior, but not new (I hit the paper cut previously ... it really is weird behavior, but I don't think we can change it now).

@scottmcm scottmcm added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label May 11, 2018
@XAMPPRocky XAMPPRocky added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants