"Anthony J. Bentley" <anth...@anjbe.name> writes: > Hi Jérémie,
Hi, > Jérémie Courrèges-Anglas writes: >> Hmm, the C standard and POSIX have slightly different texts regarding >> this. >> >> Quoting POSIX-2013: >> -->8-- >> RETURN VALUE >> >> Upon successful completion, fputwc() shall return wc. Otherwise, it >> shall return WEOF, the error indicator for the stream shall be set, >> [CX] and errno shall be set to indicate the error. > ... >> So, the C standard doesn't say that the error indicator should be set on >> the FILE in case of an encoding error, it only speaks about errno being >> set to EILSEQ. I'd say that we should follow the C standard here - >> after all "This volume of POSIX.1-2008 defers to the ISO C standard". > > The [CX] there means it's an intentional extension of ISO C. The way I read it, [CX] here only affects the last part of the sentence, "and errno shall be set to indicate the error." (because the C standard doesn't require errno to be set in all error cases.) Thus [CX] here doesn't apply to the part that speaks about the error indicator. > This is > more obvious in the HTML copy of POSIX, > http://pubs.opengroup.org/onlinepubs/9699919799/functions/fputwc.html > > Quoting more POSIX (the [CX] defintion), > > The functionality described is an extension to the ISO C standard. > Application developers may make use of an extension as it is > supported on all POSIX.1-2008-conforming systems. > > With each function or header from the ISO C standard, a statement to > the effect that "any conflict is unintentional" is included. That is > intended to refer to a direct conflict. POSIX.1-2008 acts in part as > a profile of the ISO C standard, and it may choose to further > constrain behaviors allowed to vary by the ISO C standard. -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE