On Thu, Nov 16, 2017 at 09:57:06AM -0500, Ted Unangst wrote: > Ingo Schwarze wrote: > > [EILSEQ] > > A wide-character code that does not correspond to a valid > > character has been detected. > > > > That means that the functions are *required* to fail ("shall fail") > > if encoding errors can be detected, that -1 must be returned, and > > that errno must be set. > > I understand what you're saying, but I think strictly following the standard > is a bit silly here. This is a very poor way for the fastidious programmer to > check for valid byte sequences. Also, nobody is actually that careful. I'm > actually kind of surprised that such a check is performed. Usually the rule is > that the caller is responsible for checking. strdup doesn't return an error > for a NULL pointer. I would expect if I printf "\xc0\x80" that I will get the > two bytes c0 80 as output. > > There's some danger of slippery slope here, which parts of the standard are > safe to ignore and which aren't. It's reasonable to argue it's best not to > ignore anything, but I feel pretty good about ignoring this rule as an > exception. >
I agree with Ted. I would expect EILSEQ during %lc and %ls conversions which explicitly expect wide characters as arguments, but not for arbitrary data that happens to be part of the format string.