What's the behavior if we fprintf chars to a wide orient file stream?
Can Finner
can.finner@gmail.com
Fri Aug 2 02:33:00 GMT 2013
Hi,
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
as wchar.
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.
--
Regards.
More information about the Newlib
mailing list