Format specifiers X and b suggestion · Issue #26 · tfc/pprintpp · GitHub
Skip to content

Format specifiers X and b suggestion #26

Open

Description

@ConcurrentState

Great library, thanks for it.
May I request also UPPERCASE hex 'X' and binary 'b' format specifier. 'b' is now widely implemented , e.g. glibc3.5+.
Unfortunately I have not the required grasp for the template meta stuff to make a pullover request.

Activity

  1. tfc commented on Feb 14, 2026

    @tfc
    Owner

    Hi @ConcurrentState yes, this should not be a problem. I will have a look into it!

  2. ConcurrentState commented on Feb 15, 2026

    @ConcurrentState
    Author

    This would be much appreciated. And looking add the diff then I could probably improve my understanding of template meta and learn something :-).

  3. tfc commented on Feb 16, 2026

    @tfc
    Owner

    Hi @ConcurrentState i implemented this in branch obx-formatters.

    I am not sure yet if the code shall stay like this (it is stubborn and a bit duplicated but the tradeoffs of a clean implementation might not outweigh it posively).

    In the meantime, may i ask you to check it out and test if it works as you expected ,please?

  4. ConcurrentState commented on Feb 25, 2026

    @ConcurrentState
    Author

    Hi, thsnks do far, sorry for the late reply, I testet the following line and get this result:

      pprintf("{04x} {08X} {b} {B} {08b} {16B} \n", 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a);
    // prints:  003a 0000003A %b %B %08b %16B
    
    

    The uppercase 'X' looks good, the '%b' not yet :-).

  5. ConcurrentState commented on Feb 25, 2026

    @ConcurrentState
    Author

    The reason is probably because the used printf implementation does not have the 'b' implemented. I am still away from a dev machine, but will report more soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions