[Development] QtCS 2017 QtCore sessions

André Somers andre at familiesomers.nl
Wed Nov 1 20:03:27 CET 2017



Op 01/11/2017 om 16:46 schreef Thiago Macieira:
> On quarta-feira, 1 de novembro de 2017 08:25:01 PDT Konstantin Tokarev wrote:
>>> No, not really, since it's already limited to half the full VM space. No
>>> object can be larger than that. Using unsigned is unnecessary.
>> Using unsigned for size types is crucial in preventing signed overflow in
>> pathological cases.
> 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.

André




More information about the Development mailing list