Re: [AGGREGATED PATCH] Fix in-place editing functions in convert.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/5/07, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> 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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux