Roll our own qUtf8Printable()?

Lubomir I. Ivanov neolit123 at gmail.com
Mon Feb 26 02:25:14 PST 2018


On 26 February 2018 at 11:35, Berthold Stoeger
<bstoeger at mail.tuwien.ac.at> wrote:
> On Montag, 26. Februar 2018 10:04:23 CET Lubomir I. Ivanov wrote:
>> On 26 February 2018 at 08:49, Berthold Stoeger
>>
>> <bstoeger at mail.tuwien.ac.at> wrote:
>> > On Montag, 26. Februar 2018 02:33:58 CET Thiago Macieira wrote:
>> >> > [Sidenote: There's a reason the C++-standard disallows reference
>> >> > counting
>> >> > for its string class.]
>> >>
>> >> There is, but this isn't it. The concern is the unexpected memory
>> >> allocation when calling a non-const function. The standard banned
>> >> reference counting by requiring a few of those functions to have
>> >> constant time (O(1)) operation, which can't be implemented if you need
>> >> to allocate memory and memcpy.
>> >
>> > That's how they do it, but certainly not the only reason why they do it.
>> > There are also concerns about thread safety and - I'm quite sure - code
>> > optimization.
>> >
>> > But this should be of no concern to us - since we don't use std::string.
>>
>> thanks for the explanation, Thiago!
>> we should either stay with what we have (which is the explicit way of
>> doing it using data()) or transition to using qUtf8Printable().
>> i would prefer the later for readability.
>
> Disagree - we should either switch to constData() or use qUtf8Printable()
> under the assumption that Thiago's fix will find its way into Qt soon.
>
> I have a patch for the latter and will propose a PR in due course.
>

ok, qUtf8Printable() is the way to go then.

lubomir
--


More information about the subsurface mailing list