Fix fmt::formatted_size() with compiled format (FMT_COMPILE) as argument#2161
Merged
vitaut merged 1 commit intofmtlib:masterfrom Mar 7, 2021
Merged
Conversation
Contributor
Good catch, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2141.
All useful info can be found in the issue, including code examples.
One small detail for this PR -
fmt::formatted_size()incompile.hbecomes templatized too to eliminate one unclear case - https://godbolt.org/z/Yxnccj. In few words, the implementation offmt::formatted_size()for runtime API (non-compiled format string) changes depending on whether we includefmt/compile.hor not. You can see it in assembly for theformatted_size, it usescounting_iterator, which is used in the overload fromcompile.h:fmt/include/fmt/compile.h
Lines 837 to 840 in 835b910
but not in the overload from
core.h:fmt/include/fmt/core.h
Lines 1864 to 1870 in 835b910
Maybe it's okay, but IMHO in this case, that behavior should be documented, right?