← Back to team overview

kicad-developers team mailing list archive

Re: 6.0 string proposal

 

Primarily for performance reasons.  Because characters are different lengths, you have to scan the string to find the n’th character.

(wxString solves this with cached iterators, but they’re not thread-safe and so we get random crashes from them.)

> On 30 Apr 2019, at 15:59, Dmitry Salychev <darkness.bsd@xxxxxxxxx> wrote:
> 
> On Tue, Apr 30, 2019 at 08:59:46AM -0400, Wayne Stambaugh wrote:
>> Given that std::wstring is platform dependent, I would be opposed to
>> using it.  I'm not opposed to std::u32string but UTF8 is pretty well
>> vetted so please keep that in mind.  I think the possibility of breakage
>> is low but I'm not naive enough to think that it's zero.  You would have
>> to do some serious testing to ensure the conversion of std::u32string to
>> and from UTF8 isn't broken before I would be comfortable merging it into
>> master.
>> 
>> Wayne
>> 
> These are just thoughts of a stranger.
> 
> Why not to use std::string to keep a byte array which represents a UTF-8
> string itself? Size of the string means its length in bytes and
> utf8::distance() [1] returns a number of the code points, i.e.
> length in symbols.
> 
> [1] http://utfcpp.sourceforge.net/
> 
> Regards,
> Dmitry
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References