Re: [PATCH v2] newlib: libc: Fix bugs in the commit 3d94e07c49b5.
Corinna Vinschen <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On Nov 15 15:53, Brian Inglis wrote: > On 2023-11-15 09:31, Corinna Vinschen wrote: > > Also, as in GLibC, do not set orientation in ungetc, and only set, but > > do not check orientation in ungetwc. > > Function ungetwc is a wide character input/output function, as ungetc is a > byte input/output function, as per N3096 C202X CD2 2023-04 7.23 Input/output > <stdio.h> 7.23.1 Introduction #6: Yes? The idea was to follow GLibC behaviour. The reason that GLibC ungetc does not set and check orientation is compatibility with history. https://nvlpubs.nist.gov/nistpubs/Legacy/FIPS/fipspub160.pdf, page 145 suggests that one can call ungetc on any stream. Ungetwc hadn't been introduced at the time. Therefore ungetc can't presuppose an orientation and also shouldn't set it. As for ungetwc only setting the orientation but not checking it, I didn't get a conclusive answer yet if that's deliberate or a bug. Either way, we can do it as GLibC does, or we can check the orientation. I just followed GLibC behaviour for now ¯\_(ツ)_/¯. Corinna