[Development] RFC: Proposal for a semi-radical change in Qt APIs taking strings

Bubke Marco Marco.Bubke at theqtcompany.com
Thu Oct 15 16:17:56 CEST 2015


On October 15, 2015 15:56:35 Matthew Woehlke <mwoehlke.floss at gmail.com> wrote:

> On 2015-10-15 02:38, Ziller Eike wrote:
>> So from where does 's.indexOf(ā€˜cā€™, i-2)' search?
>>
>> This is similar to integer overflow, and I think utilizing that in an
>> API leads to less readable and potentially unexpectedly behaving
>> code.
>
> It depends on the value of i, of course. And you're not going to get any
> better results with an unsigned offset.

You could get an assert or warning because you are out of range. 

>> Anyhow this seems to be only vaguely related to the things that are discussed in this thread.
>
> There was a question whether to use signed or unsigned as the size type,
> that somewhere turned into Qt's use of signed for string sizes/offsets
> being inconsistent with STL/CSL. I suppose it has wandered off a bit on
> a tangent, though.
>
 I would prefer we would be more in line with the standard library. All the casts to silence warnings are not very beautiful. 



More information about the Development mailing list