Re: Does wstream make sense?
On Sunday, 4 August 2013 21:23:20 UTC+1, Paavo Helde wrote:
Daniel <danielaparker@gmail.com> wrote in
news:a3e3fc45-1096-4f4d-aaf8-cf1716dd6340@googlegroups.com:
[concerning wstream?]
I don't understand it. It seems to be as pointless and outside the
spirit of c/c++ io as would be a floatstream or intstream.
It was possibly introduced for supporting a major OS whose whole SDK was
defined in UCS-2 (later redeclared to be UTF-16), plus maybe Java also had
some indirect influence.
If this is wstream, it was *not* introduced to support wchar_t
at the system level. Just the opposite: it was introduced to
support localization internally (e.g. where the characters you
want to output as digits aren't present in the single byte
encodings of char). It defines all system level IO in terms of
char, and defines how the wchar_t should be mapped to and from
char (in filebuf, so that you can write char, even though
everything upstream was in wchar_t).
And Java obviously had no influence, since it was designed long
before Java ever existed.
As it happens, today wchar_t is non-portable (size
heavily depending on the platform) so the utility of related concepts like
wstream is also greatly reduced.
char is also non-portable. Perhaps moreso that wchar_t, because
with very few exceptions, wchar_t will be some presentation form
of Unicode (UTF-16 or UTF-32), where as even today, the encoding
in char will often change from one locale to the next.
In my own code, for various reasons, I've adopted the policy of
using char and UTF-8 internally. But this means that I've had
to write *all* of the usual character handling functions to
support this, with new interfaces.
--
James