Skip to content

Enhancement: format (u)int8 types correctly to number, if formatted with %d, &i, %u #60

Description

@s-martin

If I try to format a (u)int8 number, Boost.Format considers this as (unsigned) char, even if I use %d, %i or %u.

This is a known and rather old issue.

The workaround is to cast the number to (u)int32, before formatting.

Nevertheless the current behavior leads to very subtle bugs, because the developer has to check the type of the number to be printed very carefully.

Plain printf handles (u)int8 numbers in combination with %d, %i or %u correctly.

Boost version: 1.68 (32bit)
Compiler: MSVC 15.8

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions