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

Comments

Projects
None yet
2 participants
@ksergey

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

This comment has been minimized.

Show comment
Hide comment

ksergey commented Jul 14, 2017

@ksergey ksergey changed the title from Please add compile-time argument checking to Please add compile-time argument count checking Jul 14, 2017

@vitaut

This comment has been minimized.

Show comment
Hide comment
@vitaut

vitaut Jul 15, 2017

Contributor

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.

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 Jul 15, 2017

@vitaut

This comment has been minimized.

Show comment
Hide comment
@vitaut

vitaut Jul 16, 2017

Contributor

Adding constexpr checks is covered by #546.

Contributor

vitaut commented Jul 16, 2017

Adding constexpr checks is covered by #546.

@vitaut

This comment has been minimized.

Show comment
Hide comment
@vitaut

vitaut Nov 6, 2017

Contributor

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).

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