Pre-DR: variadic standard library functions =========================================== To what extent should the variadic functions in and be required to act as if they use the macros to access arguments? There are at least three cases involved. The first relates to an actual conformance dispute; the others are less likely to relate to observable behavior of actual implementations. 1. Arguments of correct promoted type, but out of range for unpromoted type. #include void f(void) { // Suppose that UCHAR_MAX == 255. printf("%hhu", 256); } Here, the argument is of type int, the correct promoted type, but even printf implemented using the macros only can tell that it did not arise from an unsigned char. Is this defined, or should it be? If not, what purpose does the wording about printf converting the argument back to unsigned char before printing serve? One library implementor claims that another library implementation does not conform because it prints 256, but the argument was not an unsigned char, so is there undefined behavior? 2. Arguments of correct promoted type, and in range for unpromoted type, but not of the unpromoted type. #include void f(void) { // Suppose that unsigned char promotes to int. printf("%hhu", 0); } Here, %hhu expects an unsigned char, which has been promoted to int, but has been passed an int not derived from an unsigned char. Is this defined, or should it be? 3. Arguments of incorrect type, allowed for va_arg by 7.15.1.1#2. #include void f(void) { printf("%x", 0); } Here, an int argument is passed where an unsigned int is expected, but the value is representable in both types. Is this defined, or should it be?