[Interest] Operator QMap<uint, uint>[] is casting to int?
Jason H
jhihn at gmx.com
Tue May 7 14:42:43 CEST 2019
> Sent: Saturday, May 04, 2019 at 11:48 AM
> From: "Thiago Macieira" <thiago.macieira at intel.com>
> To: interest at qt-project.org
> Subject: Re: [Interest] Operator QMap<uint, uint>[] is casting to int?
>
> On Saturday, 4 May 2019 05:12:08 PDT Roland Hughes wrote:
> > On 5/4/19 5:00 AM, interest-request at qt-project.org wrote:
> > >> Unless Qt supports negative indexes (like python's [-1]) I would have
> > >> thought this would be an int. Thanks for catching that everyone.
> > >
> > > I'm assuming you made a typo there and meant to say "uint"? Regardless
> > > here's the official reason why Qt uses "int" for container indices:
> > > https://lists.qt-project.org/pipermail/interest/2013-September/008592.html
> >
> > There are an awful lot of places where Qt uses int when it should be
> > uint like when returning the size() of something.
>
> Those will likely change to qsizetype in Qt 6. Which is still signed.
This is disappointing. I'll only get half of the indexable space... can I get something in return? Having a negative index mechanism, like in Python, would be a way to alleviate some of the pain. Otherwise can you explain the rationale for not using signed?
More information about the Interest
mailing list