Calypsi-tool-chains icon indicating copy to clipboard operation
Calypsi-tool-chains copied to clipboard

Printf is not handling some format specifiers correctly

Open rebeccabuckingham opened this issue 1 year ago • 3 comments

Noticed with %ld and %lu:

` long x = 1984;

// this prints 'x is %ld', the value of x isn't substitued in the string // removing the 'l' will result in a compiler warning // "format specifies type 'int' but the argument has type 'long'" printf("x is %ld\n", x);

unsigned long y = 9000;

// this prints 'y is %lu', the value of y isn't substituted in the string. // removing the 'l' will result in a compiler warning. printf("y is %lu\n", y);`

rebeccabuckingham avatar May 04 '23 02:05 rebeccabuckingham