I wonder if this yields in undefined behaviour:
printf("Test %d %s", 123, "abc", "def", "ghi");
The first two arguments after the format string match the format string, so these are OK; but the 3rd and 4th arguments are in excess because there are no more corresponding format specifiers.
IMHO printf()
should simply ignore these excess arguments and there should be no UB. Is this correct?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…