To Walter, about char[] initialization by FF

Oskar Linde oskar.lindeREM at OVEgmail.com
Wed Aug 2 00:06:59 PDT 2006


Andrew Fedoniouk wrote:
> "Unknown W. Brackets" <unknown at simplemachines.org> wrote in message 
> news:eapdsg$qeo$1 at digitaldaemon.com...
>> I'm trying to understand why this 0 thing is such an issue.  If your 
>> second statement is valid, it makes the first moot - 0 or no 0.  Why does 
>> it matter, then?
> 
> Declaration of char.init == 0 pretty much means that
> D has no strict requirement that char[] shall contain only UTF-8
> encoded sequences but any other encodings suitable for
> the application.

Why is this good?

> char.init == 0 will resolve situation we see in Phobos now.
> char[] de facto is used for other than utf-8 encodings.

You mean data with other encodings that still want to use the std.string 
functions? I have written template versions that replaces (almost) all 
std.string functions that do not rely on encoding.

> char.init == 0 tells everybody that char can also be used
> for representing unicode *code points* with asuumption
> that offset value (mapping on full Unicode set, aka codepage) is stored
> somewhere in application or well known to it.

Maybe it would tell people that. A good thing it isn't so then. Again, 
why do you want to store non utf-8 data in a char[]?. What is wrong with 
ubyte[] or a suitable typedef?

> char.init == 0 also highlights the fact that it is safe to
> use char[] as C string processing functions and passing them to non D 
> modules and libraries.
> Is it UTF-8 encoded or not - does not matter - type is universal enough.

I can't see how that would make it considerably safer.

/Oskar



More information about the Digitalmars-d mailing list