PrintEx icon indicating copy to clipboard operation
PrintEx copied to clipboard

develop branch - support for printf with no parameters

Open GiovanniCmpaner opened this issue 6 years ago • 1 comments

I'm trying to use printf with empty parameters, like:

printf("Just a debug string")

Currently, I get a compiler error with the original code.

The solution is to change these lines: https://github.com/Chris--A/PrintEx/blob/7e13cfc1998920262e1f575def2c146ac8958523/src/lib/PrintExtension.h#L202-L203 https://github.com/Chris--A/PrintEx/blob/7e13cfc1998920262e1f575def2c146ac8958523/src/lib/PrintExtension.h#L208

To:

#define sprintf(buff, str, ...) GString(buff).printf(str, ##__VA_ARGS__)
#define xprintf(out, str, ...) PrintEx(out).PRINTF_ALIAS(str, ##__VA_ARGS__)
#define printf(format, ...) PRINTF_ALIAS(format, ##__VA_ARGS__)

Note the leading ## in __VA_ARGS__

GiovanniCmpaner avatar Dec 26 '18 19:12 GiovanniCmpaner

What is the status of this issue. Seems like something that should get fixed for sure.

scottchiefbaker avatar Jan 31 '19 21:01 scottchiefbaker