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

Please add compile-time argument count checking #544

Closed
ksergey opened this issue Jul 14, 2017 · 4 comments
Closed

Please add compile-time argument count checking #544

ksergey opened this issue Jul 14, 2017 · 4 comments

Comments

@ksergey
Copy link

ksergey commented Jul 14, 2017

Will be good if fmtlib will check number of arguments matched to number of arguments placeholders in format string.

@ksergey
Copy link
Author

ksergey commented Jul 14, 2017

@ksergey ksergey changed the title Please add compile-time argument checking Please add compile-time argument count checking Jul 14, 2017
@vitaut
Copy link
Contributor

vitaut commented Jul 15, 2017

Thanks for the suggestion, but note that the number of placeholders doesn't have to be the same as the number of arguments because there can be multiple placeholders referring to the same arguments:

fmt::format("{0}{0}", 42);

That said I plan to add a constexpr function for checking the format string. Will track it as a separate issue because it's part of the LEWG feedback.

@vitaut vitaut closed this as completed Jul 15, 2017
@vitaut
Copy link
Contributor

vitaut commented Jul 16, 2017

Adding constexpr checks is covered by #546.

@vitaut
Copy link
Contributor

vitaut commented Nov 6, 2017

Compile-time format string checks are now available: http://zverovich.net/2017/11/05/compile-time-format-strings.html (note that it is still allowed not to use some arguments).

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