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

error C2661: 'fmt::format' : no overloaded function takes 13 arguments #64

Closed
pkbig opened this issue Sep 11, 2014 · 9 comments
Closed

Comments

@pkbig
Copy link

pkbig commented Sep 11, 2014

error C2661: 'fmt::format' : no overloaded function takes 13 arguments

@vitaut
Copy link
Contributor

vitaut commented Sep 11, 2014

When using a compiler that doesn't support variadic templates, the number of arguments to the formatting functions is currently limited to 10. Which compiler do you use?

@pkbig
Copy link
Author

pkbig commented Sep 11, 2014

I am using VS2010, How to expand the support?

@pkbig
Copy link
Author

pkbig commented Sep 11, 2014

This code compiler is no problem.
printf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,",1,1,1,1,1,1,1,1,1,1,1,1,1);

@newnon
Copy link
Contributor

newnon commented Sep 11, 2014

only VS2013 support Variadic templates
for your compiler it is some Macros magic to emulate such functional

@pkbig
Copy link
Author

pkbig commented Sep 11, 2014

Say so, compiler < vs2013 is only limited in the 10 parameter?

@vitaut
Copy link
Contributor

vitaut commented Sep 11, 2014

Right, VS2010 doesn't support variadic templates, so variadic functions are emulated using macros there. I can increase the limit if you like if you are sure that you want to pass more parameters to the formatting functions. Do you have a practical example or you just exploring the limitations?

@pkbig
Copy link
Author

pkbig commented Sep 12, 2014

Hope to be able to increase the limit, it can meet various requirements.

I asked our team to recommend the use of cppformat, and hopes to be able to eliminate the boost.format, will eventually be used in our products, our products have more than 15 parameters of the demand.

Thank you, sir.
The great works.

@pkbig
Copy link
Author

pkbig commented Sep 12, 2014

igmss.cpp: In function 'int main(int, char*)':
igmss.cpp:9: error: no matching function for call to 'format(const char [21], int, int, int, int, int, int, int, int, int, int, int, int)'
format.h:1743: note: candidates are: std::string fmt::format(fmt::StringRef, const fmt::ArgList&)
format.h:1749: note: std::wstring fmt::format(fmt::WStringRef, const fmt::ArgList&)
format.h:2039: note: std::string fmt::format(fmt::StringRef)
format.h:2040: note: std::wstring fmt::format(fmt::WStringRef)
make: *
* [main.o] Error 1

[ivm1001@localhost ~]$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)

[ivm1001@localhost ~]$ cat /etc/redhat-release
CentOS release 6.5 (Final)

The use of cppformat in the old compiler, the performance will be reduced?

@vitaut
Copy link
Contributor

vitaut commented Sep 12, 2014

Thanks for the additional information. I've increased the formatting argument limit on compilers without variadic template support to 15 in d59fbdc . Feel free to reopen this issue if you need more, it's pretty easy to increase further if necessary.

The performance shouldn't depend much on whether variadic templates are supported or not, because the code is virtually identical, in both cases an array of arguments is constructed and passed to the main formatting function which is the same for C++11 & older compilers.

@vitaut vitaut closed this as completed Sep 12, 2014
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

3 participants