Hi Jérémie,

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. 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.

-- 
Anthony J. Bentley

Reply via email to