From 8190732537238610870
X-Google-Thread: 7894ca11fe,b57b42a3a23f7d43,start
X-Google-Attributes: gid7894ca11fe,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news1.google.com!newsfeed.stanford.edu!news.kjsl.com!news.alt.net!frodo.cs.rpi.edu!not-for-mail
From: Scott Meyers <smeyers@aristeia.com>
Newsgroups: comp.std.c++
Subject: C++0x string conversions, etc.
Date: Thu, 27 Aug 2009 16:45:34 CST
Organization: unknown
Lines: 46
Sender: cppmods@cs.rpi.edu
Approved: stephen.clamage@sun.com
Message-ID: <7.0.0.16.2.20090826221507.040f5928@aristeia.com>
NNTP-Posting-Host: netlab.cs.rpi.edu
Content-Type: text/plain; charset="us-ascii"
To: (Usenet)
Return-Path: <cppmods@ruralroute.cs.rpi.edu>
X-Original-Date: Wed, 26 Aug 2009 22:18:06 -0700
X-Submission-Address: std-c++@netlab.cs.rpi.edu
Xref: g2news2.google.com comp.std.c++:1319

In draft C++0x (N2914), 22.4.1.4/3 says (in part):

   codecvt<char, char, mbstate_t> implements a degenerate conversion; it
   does not convert at all.

This is also part of C++03.  What is the point of requiring the presence of
a no-op conversion?

22.4.1.4/3 continues:

   The specialization codecvt<char16_t, char, mbstate_t> converts between
   the UTF-16 and UTF-8 encoding schemes

However, 22.5/6 says

   For the facet codecvt_utf8_utf16:
   - The facet shall convert between UTF-8 multibyte sequences and UTF-16
     (one or two 16-bit codes) within the program

This seems to say that we have two codecvt instantations that convert
between UTF-8 and UTF-16 string representations.  Why do we need both?

Now, everything I know about ISO 10646/Unicode/UTF-n/UCS-n, etc., I got
from reading pages at Wikipedia in the last hour or so, so pardon me if
this is a silly question, but:

- If I have a pointer p of type char16_t* that points to a string encoded
   using UTF-16 (a multibyte format) and I say ++p, does p move forward a
   single (multibyte) character or a fixed number of machine bytes?  In
   other words, can a compiler generate a fixed increment for the value of p
   (as it would be able to do with a char* pointer), or must the value of
   the increment be determined at runtime based on the character p points
   to?

Thanks,

Scott



-- 
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



