Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment of integer has changed #1801

Closed
gsjaardema opened this issue Aug 3, 2020 · 2 comments
Closed

Alignment of integer has changed #1801

gsjaardema opened this issue Aug 3, 2020 · 2 comments

Comments

@gsjaardema
Copy link
Contributor

If i use the L or n formatting of integers with a specified value for FMT_STATIC_THOUSANDS_SEPARATOR, the default alignment seems to have changed with version 7.0.0 and later. Below is the behavior I am seeing:

(base) s1041980:fmt((HEAD detached at 7.0.0))> cat test.C
#define FMT_STATIC_THOUSANDS_SEPARATOR ','
#define FMT_DEPRECATED_N_SPECIFIER

#include <string>
#include <fmt/ostream.h>

int main() {
  fmt::print("Check alignment of integer {:14L}\n", 1000);
}

Version 7.0.0, Note that the integer that is output is left-justified in the 14 width field:

(base) s1041980:fmt((HEAD detached at 7.0.0))> g++ -DFMT_HEADER_ONLY --std=c++14 -o align_test test.C -I include; ./align_test
Check alignment of integer 1,000

Now, with version 6.2.1, the integer is right-justified (which should be the default as I read documentation):

(base) s1041980:fmt((HEAD detached at 6.2.1))> g++ -DFMT_HEADER_ONLY --std=c++14 -o align_test test.C -I include; ./align_test
Check alignment of integer          1,000

Am I using this correctly? If so, was this an intentional change in the default alignment?
Thanks.

@vitaut
Copy link
Contributor

vitaut commented Aug 3, 2020

Am I using this correctly?

Yes.

If so, was this an intentional change in the default alignment?

No.

That's a bug in locale-specific integer formatting. Fixed in 279d698, thanks for reporting.

@vitaut vitaut closed this as completed Aug 3, 2020
@gsjaardema
Copy link
Contributor Author

Thanks for the quick response. Awesome library.

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

No branches or pull requests

2 participants