This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

What's the behavior if we fprintf chars to a wide orient file stream?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]