perror() changes the orientation of stderr to byte-oriented mode if stderr is not oriented yet.

Corinna Vinschen vinschen@redhat.com
Thu Jun 28 18:44:00 GMT 2018


On Jun 28 12:28, Craig Howland wrote:
> On 06/27/2018 08:55 AM, Corinna Vinschen wrote:
> > ...
> > 
> > 
> > On Jun 27 20:01, Takashi Yano wrote:
> > > POSIX states:
> > > The perror() function shall not change the orientation of the standard
> > > error stream.
> > > 
> > > However, cygwin perror() function changes the orientation of stderr to
> > > byte-oriented mode if stderr is not oriented yet.
> I suggest that POSIX is in error.  The POSIX statement about not changing
> the orientation is an extension to the C standard (CX, to be precise). 
> POSIX is always careful to defer to the C standard, which I think does
> indirectly specify that perror() is byte-oriented.  The C standard actually
> does not directly talk about the orientation of perror().  However, it
> directly defines (quoting from the N1570 C11 draft):
> [...]
> Therefore, the newlib perror() behavior is correct and should not be
> changed.  It definitely is a mess and there really ought to be a perrorw()
> function.

Interesting discussion.

Under the assumption the standard isn't quite clear on this, we have 
OpenBSD, FreeBSD and Linux interpreting the standard as "don't change
orientiation from perror".  NetBSD doesn't care, just like Newlib.

As far as I can see, the NetBSD and the Newlib code are older than
the interpretation of the other three.  Does the new interpretation
set a precedent?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20180628/c2fa47e8/attachment.sig>


More information about the Newlib mailing list