[Interest] Operator QMap<uint, uint>[] is casting to int?

Jason H jhihn at gmx.com
Tue May 7 17:02:45 CEST 2019

> Sent: Tuesday, May 07, 2019 at 9:31 AM
> From: "Giuseppe D'Angelo via Interest" <interest at qt-project.org>
> To: interest at qt-project.org
> Subject: Re: [Interest] Operator QMap<uint, uint>[] is casting to int?
> On 07/05/2019 14:42, Jason H wrote:
> >> 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?
> I guess you meant "not using unsigned" here?
> Half of the memory space is the theoretical maximum you get anyhow, no
> matter the signedness of the index, right?
> (You need to be able to take the pointer difference between any two
> positions in an array (including the one-past-the-end). Given that
> ptrdiff_t is the same size of a pointer, and has to be signed, that
> means that the biggest contiguous block of memory you can index is half
> of the address space. What am I not seeing?)

Ah, that's probably what I'm missing.

Given how often I miss indexing negatives (to index from the end) It seems that we could do this in Qt6?
/me ducks

More information about the Interest mailing list