To Walter, about char[] initialization by FF
Walter Bright
newshound at digitalmars.com
Sat Jul 29 15:20:29 PDT 2006
Andrew Fedoniouk wrote:
>>> What is the point of current initializaton?
>> The point is to initialize it with an invalid value, in order to flush out
>> uninitialized data errors.
>>
>>> If you are doing intialization already
>>> and this intialization is a part of specification so why not to use
>>> official "Nul" values in this case?
>> Because 0 is a valid UTF-8 character.
>
> 1) What "UTF-8 character" means exactly?
For an exact answer, the spec is: http://www.ietf.org/rfc/rfc3629.txt
There isn't much to it.
> 2) In ASCII char(0) is officially NUL. Why not to initialize strings
> by null?
Because 0 characters are valid UTF-8 values. By using an invalid UTF-8
value, we can flush out bugs from uninitialized data.
> I don't get it, sorry. In KOI-8R (Russian) enconding 0xFF is letter '?'
> Are you saying that I cannot use char[] to represen russian text in D?
char[] is for UTF-8 encoded text only. For other encoding systems, use
ubyte[]. But rest assured that Russian (and every other language) has a
defined encoding in UTF-8, which is why it was selected for D.
More information about the Digitalmars-d
mailing list