Skip to content

Avoid using strlen to get return size#326

Open
pps83 wants to merge 1 commit intocppalliance:developfrom
pps83:develop-tostr
Open

Avoid using strlen to get return size#326
pps83 wants to merge 1 commit intocppalliance:developfrom
pps83:develop-tostr

Conversation

@pps83
Copy link

@pps83 pps83 commented Feb 14, 2026

  • leave output buffer unset

 + leave output buffer unset
@pps83 pps83 changed the title Develop tostr Avoid using strlen to get return size Feb 14, 2026
char buffer[64];
const auto last {detail::mini_to_chars(buffer, value, 10, false)};
return std::string{last};
return std::string{last, buffer + sizeof(buffer)};
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps, a comment explaining that mini_to_chars outputs in from the end of the buffer?

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.

1 participant