Skip to content

Conversation

elipsitz
Copy link

@elipsitz elipsitz commented Oct 1, 2020

The %p format is not defined by the standard, that is, it's implementation specific. However, many people are used to what glibc prints: 0x to emphasize that pointers are printed as hex, and a special "(nil)" string when a null pointer is provided, and lower-case letters for hex digits.

This fixes #57 and fixes #84.

This means prefixing with `0x` and using lowercase hex letters.
This means printing "(nil)" instead of "0".
@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2020

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@eyalroz
Copy link

eyalroz commented Jun 28, 2021

Since this is non-standard, I suggest you have a preprocessor define controlling whether %p support is compiled-in or not. Also, what systems print %p the way the library does right now?

KarlK90 pushed a commit to qmk/printf that referenced this pull request Jul 7, 2022
…d and significant doxygen comment edits.
maribu added a commit to maribu/RIOT that referenced this pull request Aug 22, 2025
newlib and picolibc already implicitly add the `0x` prefix for `%p` just
as glibc does, and some of our tests scripts depend on this.

(And subjectively, this looks better.)

This adds mpaland/printf#90 on top of our
patches.
baptleduc pushed a commit to baptleduc/RIOT that referenced this pull request Sep 4, 2025
newlib and picolibc already implicitly add the `0x` prefix for `%p` just
as glibc does, and some of our tests scripts depend on this.

(And subjectively, this looks better.)

This adds mpaland/printf#90 on top of our
patches.
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.

%p prints uppercase alphabets %p format
3 participants