Flags in a format specifier are repeated or ignored.
The library routines will ignore part of the specifier, but this may not be the intended result. Review the specifier to express the desired behavior in a clearer way.
ID |
Observation |
Description |
---|---|---|
1 |
Format mismatch |
Place where the format string was used |
#include <stdio.h> int main(int argc, char **argv) { int x = 1; printf("%02d", x); // prints "01" printf("%-2d", x); // prints "1 " // Following statement would be flagged because 0 flag is ignored printf("%0-2d", x); // prints "1 " }
Copyright © 2010, Intel Corporation. All rights reserved.