printf icon indicating copy to clipboard operation
printf copied to clipboard

Change %p formatting to match glibc

Open elipsitz opened this issue 5 years ago • 2 comments

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.

elipsitz avatar Oct 01 '20 16:10 elipsitz

Codecov Report

Merging #90 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #90   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          359       362    +3     
=========================================
+ Hits           359       362    +3     
Impacted Files Coverage Δ
printf.c 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d3b9846...729dd39. Read the comment docs.

codecov-commenter avatar Oct 01 '20 16:10 codecov-commenter

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?

eyalroz avatar Jun 28 '21 18:06 eyalroz