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

format.h doesn't handle char* correctly #32

Open
jrabinow opened this issue Dec 3, 2020 · 0 comments
Open

format.h doesn't handle char* correctly #32

jrabinow opened this issue Dec 3, 2020 · 0 comments

Comments

@jrabinow
Copy link

jrabinow commented Dec 3, 2020

char *foobar = "lorem ipsum";
format("dolor sit {1} amet", foobar);

Expected result:
"dolor sit lorem ipsum amet"

Actual result:
"dolor sit dolor sit amet amet"

When passing in a char*-type variable to format's varargs list, need to cast the variable to std::string or convert it to a std::string. Not doing so results in fmt variable (first arg) being read a second time as one of the vararg variables.

Not a major issue but this small wart can take people by surprise - if this is wontfix, may I recommend adding a comment in the source?

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

1 participant