string types: const(char)[] and cstring
renoX
renosky at free.fr
Sun May 27 15:53:50 PDT 2007
Regan Heath a écrit :
> renoX Wrote:
>> I agree with you, I don't think that the string should be a char[]
>> alias, wether it's const or not but a class with
>> char[],dchar[],wchar[] under the hood representation and safe
>> slicing by default.
>>
>> The difficulty is providing enough flexibility for managing
>> correctly the internal representation: there should be a
>> possibility to say use UTF8 even though there are multibyte
>> characters for example (a size optimization with some CPU cost).
>
> I think the class you describe would be useful, but only for certain
> types of application. Many applications (those that deal with ASCII
Hopefully a rare thing now.
> or only one of UTF8, 16 or 32 for example)
Sure, but this makes the code less portable (or less efficient when it's
not on its "original" OS): Windows use UTF16, Linux UTF8..
> wont need the sorts of
> things this class provides and can get away with just using
> 'const(char[])' AKA 'string'. Basically I think there is a ample
> room for both 'string' as an alias and 'String' as a class to exist
> at the same time.
Room of course, but IMHO one should almost always use the class (except
in wrappers of native calls) instead of the alias.
renoX
>
> Regan
More information about the Digitalmars-d-announce
mailing list