I am implementing support for the C11 _Float16 type, see , as defined in ISO/IEC TS 18661 and have a question about default argument promotions for variadic functions.
For the *decimal* floating types the behaviour is well specified as section “9.5 Default argument promotion” in  reads:
“There is no default argument promotion specified for the decimal floating types. Default argument promotion
covered in C11 22.214.171.124  and  remains unchanged, and applies to standard floating types only.”
But for the *binary* floating types such a paragraph is absent by N1774, see , so the question is if default argument promotion should apply here? Another way of looking at TS 18661 is as a set of changes to the C11 specification,
in which case absence of an edit to 126.96.36.199 would mean that the current text still applies, i.e. only float is promoted to double, which is the approach GCC has taken: “In TS 18661-3, _Float16 is *not* affected by default argument promotions; only float is.”,
see e.g. this message on the GCC list .
First of all, I don’t quite understand why the binary floating type spec does not mention default argument promotion, but secondly and more importantly, how does e.g. printf works now? Default argument promotion to double would actually
be really convenient/user-friendly because printf(“%f”) would just work, which is currently broken. Assuming that default argument promotion does not apply, I am expecting the spec to say something about string format specifier for _Float16 types, but haven’t
found anything (if I didn’t miss anything).
One workaround is to document that explicit casts are required, e.g. printf(“%f”, (double)MyFloat16), but this of course not ideal. Another one is to create a specifier for Float16, or let e.g. some length modifier apply to “f”. But perhaps
default argument promotion for variadic functions wouldn’t be so bad after all? I was wondering if anyone has some thoughts on this?