[Issue 3784] New: Interpretation of hex string and escape sequences unclear
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 8 19:20:08 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3784
Summary: Interpretation of hex string and escape sequences
unclear
Product: D
Version: 2.040
Platform: All
URL: http://digitalmars.com/d/2.0/lex.html
OS/Version: All
Status: NEW
Keywords: spec
Severity: normal
Priority: P2
Component: www.digitalmars.com
AssignedTo: nobody at puremagic.com
ReportedBy: jlquinn at optonline.net
--- Comment #0 from Jerry Quinn <jlquinn at optonline.net> 2010-02-08 19:20:07 PST ---
Are the contents of a hex string interpreted as bytes or as the postfix
indicates?
string a = x"fedcfedc"; // compiles
dstring b = x"fedcfedc"d; // error - illegal unicode.
The compiler apparently considers the double-quoted contents to be UTF-8 that
must be converted to UTF-32 due to the 'd' postfix. The spec does not make
this clear. It is reasonable to read the spec as allowing the second
declaration.
A similar question exists about escape sequences since these are deemed
equivalent to:
string c = "\xfe\xdc\xfe\xdc";
dstring d = "\xfe\xdc\xfe\xdc"d;
Also, is 'd' equivalent to:
dstring e = "\ufedc\ufedc"d;
or
dstring f = "\Ufedcfedc"d;
both of which are illegal unicode?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list