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

Matthew Woehlke mwoehlke.floss at gmail.com
Thu Oct 15 15:56:04 CEST 2015


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.

> 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.

-- 
Matthew




More information about the Development mailing list