Re: [PATCH] newlib: libc: Fix bugs in the commit 3d94e07c49b5.
Corinna Vinschen <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <ZU5ViCXafrBbt/[email protected]> |
On Nov 10 16:17, Corinna Vinschen wrote: > Didn't you forget ungetwc? > > But then again, I checked GLibC, and there's something weird: > > ungetc does not at all set or test the orientation. > > ungetwc sets the orientation to 1, but doesn't check it. > > Puzzeling. I wonder about the reasoning behind this. Apparently, ungetwc has been added only later. ungetc, OTOH, was defined in a way which allowed to use it on wide-char oriented streams as well. So the stance in GLibC is, for backward compatibility reasons, ungetc can't and must not check or set the orientation at all. The fact that ungetwc doesn't test the orientation might be a bug in glibc. We can follow suit (being "bug-compatible" :)), or we can test the orientation. Given that using the correctly oriented functions is ultimately the responsibility of the application, both ways to handle this should be fine. Corinna