[Development] [Proposal] Replace size related parameters with size_t

Kurt Pattyn pattyn.kurt at gmail.com
Tue Dec 24 19:26:27 CET 2013


QString, QByteArray, QList, aso often use sign integers to store sizes, indexing, aso.
This often leads to signed/unsigned mismatches and is not really according standard practice.
Also, this restricts the indexes, sizes, aso to 32-bit.
One solution to resolve the signed/unsigned mismatch is to cast the types to the appropriate type, but this can be dangerous, and hides the real problem.

A better approach would be to use std::size_t.

My proposal is to replace all int types with size_t where appropriate.

I realise that this has a major impact on compatibility, but it is certainly something that should be considered.
A solution to the compatibility problem could be to duplicate the methods and mark the old ones as obsolete.

What are your thoughts?

/Kurt


More information about the Development mailing list