Skip to content

Use std::ostringstream for numeric formatting #419

@cdunn2001

Description

@cdunn2001

We've had lots of problems with std::snprintf. E.g. #418.

As BillyGoto says:

Could we switch to std::ostringstream instead? Its numeric formatting is actually specified in terms of printf's output, and it's everywhere.

Activity

dota17

dota17 commented on Oct 17, 2019

@dota17
Member

I've tried to refactory valueToString(), but I find that it's performance is not very good.
If we consider the performance or efficiency, std::ostringstream() performance is not comparable to std::snprintf(), if we consider the safety or simplicity std::ostringstream() is better than std::snprintf().

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Use std::ostringstream for numeric formatting · Issue #419 · open-source-parsers/jsoncpp