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

fmt %d renders pointers in hexadecimal, not decimal #3936

Closed
adonovan opened this issue Aug 10, 2012 · 2 comments
Closed

fmt %d renders pointers in hexadecimal, not decimal #3936

adonovan opened this issue Aug 10, 2012 · 2 comments

Comments

@adonovan
Copy link
Member

When %d converts a pointer value, it prints it in hexadecimal.  I would expect %d to
print decimal, but the fmt documentation doesn't specify this case.

(Personally I'd prefer that converting a pointer other than via %v or %p was a runtime
error, or better still, a static error when the format string is literal, as in gcc.)

http://play.golang.org/p/7sPim-5UgD

So:
- please document/specify the intended behaviour.
- please honor the radix of the conversion specifier.
@griesemer
Copy link
Contributor

Comment 1:

Owner changed to @robpike.

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Aug 17, 2012

Comment 2:

This issue was closed by revision 3ba0f6d.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants