J
jacob navia
There are several implementations of printf that allow users to define
new %X formats.
gcc and trio_printf propose a new function like
SetNewPrintfFormat(char format, ...); // arguments are compiler specific
for instance:
PrintfFlags pf_flags = FLAG_ALTERNATE;
PrintfCallback MyFormattingFunction;
SetNewPrintfFormat('C',MyFormattingFunction);
Then, you can write:
printf("Customer: %C\n",customer);
The problem with this approach is that all functions that check printf
arguments within the compiler do not know about the %C format and will
report spurious warnings.
I am thinking that a
#pragma printf('C',MyFormattingFunction)
would be much better in the sense that the compiler would be informed of
the substitution and can take it into account in its printf checking
routines.
What do you think?
What problems ould be involved with this approach?
Thanks in advance for your input.
jacob
new %X formats.
gcc and trio_printf propose a new function like
SetNewPrintfFormat(char format, ...); // arguments are compiler specific
for instance:
PrintfFlags pf_flags = FLAG_ALTERNATE;
PrintfCallback MyFormattingFunction;
SetNewPrintfFormat('C',MyFormattingFunction);
Then, you can write:
printf("Customer: %C\n",customer);
The problem with this approach is that all functions that check printf
arguments within the compiler do not know about the %C format and will
report spurious warnings.
I am thinking that a
#pragma printf('C',MyFormattingFunction)
would be much better in the sense that the compiler would be informed of
the substitution and can take it into account in its printf checking
routines.
What do you think?
What problems ould be involved with this approach?
Thanks in advance for your input.
jacob