This is the mail archive of the
mailing list for the newlib project.
What's the behavior if we fprintf chars to a wide orient file stream?
- From: Can Finner <can dot finner at gmail dot com>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Fri, 2 Aug 2013 10:33:23 +0800
- Subject: What's the behavior if we fprintf chars to a wide orient file stream?
I noticed that vfprintf calls to __sprint_r/__sfputs_r in newlib and
function __sprint_r checks whether the file stream has wide
orientation. It seems if we fprintf chars to a wide orient file, we
will get wrong output characters because consecutive chars are treated
So the first question is: Is this undefined behavior?
Furthermore, if it is undefined behavior, could we split __sprint_r
into two versions each for vfprintf and vfwprintf, and don't support
wide char in the version for vfprintf. If this can be done, the newly
added --disable-newlib-wide-orient option can be cleaned up, meanwhile
code size of vfprintf can be kept small.
Thanks in advance for your explanation.