[Development] Is qsizetype *documented* to be ptrdiff_t?
Lars Knoll
lars.knoll at qt.io
Tue Sep 1 13:21:05 CEST 2020
> On 31 Aug 2020, at 13:55, Giuseppe D'Angelo via Development <development at qt-project.org> wrote:
>
> Quick question (before Hyrum's law kicks in): qsizetype is currently defined as ptrdiff_t, but is it documented to be so?
It is defined as qint64, which is not always ptrdiff_t. I proposed to Thiago to change that, but he has some concerns. As far as I understood, the main issue is that ptrdiff_t is long on some platforms and long long on others.
One issue with that is that we traditionally didn’t provide overloads for long for methods like QString::number() etc.
>
> For instance, is one supposed to print it in printf using %td?
Right not, you need to cast to ptrdiff_t and then use %td.
Cheers,
Lars
More information about the Development
mailing list