Some questions about strings
Denis
noreply at noserver.lan
Mon Jun 22 03:17:54 UTC 2020
I have a few questions about how strings are stored.
- First, is there any difference between string, wstring and
dstring? For example, a 3-byte Unicode character literal can be
assigned to a variable of any of these types, then printed, etc,
without errors.
- Are the characters of a string stored in memory by their
Unicode codepoint(s), as opposed to some other encoding?
- Assuming that the answer to the first question is "no
difference", do strings always allocate 4 bytes per codepoint?
- Can a series of codepoints, appropriately padded to the
required width, and terminated by a null character, be directly
assigned to a string WITHOUT GOING THROUGH A DECODING / ENCODING
TRANSLATION?
The last question gets to the heart of what I'd ultimately like
to accomplish and avoid.
Thanks for your help.
More information about the Digitalmars-d-learn
mailing list