[Development] QtCS 2017 QtCore sessions
Thiago Macieira
thiago.macieira at intel.com
Wed Nov 1 21:00:59 CET 2017
On quarta-feira, 1 de novembro de 2017 12:03:27 PDT André Somers wrote:
> Using signed for size types is crucial because the API expects to be able to
> > count backwards from the end and needs to report failure in other
> > situations. So unsigned is simply ruled out.
>
> I think we're stuck with that API indeed, but _if_ we had the freedom to
> re-design it, it would not be my choice to do it this way. I'd sooner
> choose for an explicit flag for the first case, and something like
> std::optional as a return value to handle the error-reporting case. I'd
> find that more explicit that using negative indices. However, I guess we
> cannot possibly break API that badly in Qt 6, so doing something like
> that is out of the question.
That doesn't allow implementing indexOf() that searches from a position from
the end. It's not just failure modes.
So, no, even with a redesign we'd stick with signed.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list