c++ - swprintf declaration mismatch -


i use mingw g++ compiler on windows (gcc version 4.8.1) , confused swprintf declaration

according this reference should be

int swprintf (wchar_t* ws, size_t len, const wchar_t* format, ...); 

however when use

swprintf(my_ws, 32, l"hello"); 

i error

initializing argument 2 of 'int swprintf(wchar_t*, const wchar_t*, ...)' [-fpermissive] 

looks size_t len not in declaration. reference wrong, did miss or there story behind that?

you using c library not compliant c99 standard.

mingw port of gcc uses microsoft c runtime library.

microsoft had own version of swprintf different prototype before standardized c99. old c library lot of c99 incompatibilities, example don't think printf supports %zu size_t...

you should upgrade more recent version of mingw if use more recent runtime. if not, going have use old prototype, , live these obsolete apis.


Comments