5.35 printf_args Pragma
Use this pragma directive on a function with a printf-style format string. For any call to that
function, the compiler verifies that the argument to each conversion specifier, for
example %d
, is syntactically correct.
Suggested Replacement
Not officially supported in XC32 (contradicts IAR compatibility chart but use of attribute is not documented).
Caveats
None.
Examples
Consider migrating IAR code such
as:
#pragma __printf_args
int printf(char const *,...);
void PrintNumbers(unsigned short x)
{
printf("%d", x); /* Compiler checks that x is an integer */
}
to
MPLAB XC codes similar
to:extern int
my_printf (void *my_object, const char *my_format, ...)
__attribute__ ((format (printf, 2, 3)));
Further Information
None.