From: Dmitry Potapov Date: Fri, 05 Oct 2007 19:27:55 GMT Subject: Re: [AGGREGATED PATCH] Fix in-place editing functions in convert.c Message-ID: <37fcd2780710051227n96d29a9v543831ca8292c862@mail.gmail.com> In-Reply-To: On 10/5/07, Linus Torvalds wrote: > - Qt (QString): QString::"data()", "ascii()" or "utf8()" or something. > > At least this has the excuse of really being able to handle different > locales (it didn't do that originally, though!), but they end up having > a million helper functions exactly because you cannot use the normal > string routines on anything! I am afraid you cannot allow the direct access to the internal buffer of a string if this buffer can be implicitly shared between different instances as it is the case with QString. Because when you want to make some modification or want to get a non-const pointer to this buffer, its content has to be copied if the buffer is shared between a few copies. On the other hand, I don't see what is the problem with using C string routines with it. ::data() returns a pointer and :capacity () returns allocated size of the buffer. ::resize() changes the size of the string. If you need a greater allocated size, you can use ::reserve(). Or did I miss something? Dmitry