[Development] QtCS2019 Notes: QtCore

Konrad Rosenbaum konrad at silmor.de
Sun Nov 24 12:31:32 CET 2019


On 11/23/19 9:47 AM, André Pönitz wrote:
>     qsizetype QContainer::size()
>     int QContainer::count() const

Please no! This will forever flood the interest mail list with questions 
about what the difference between the two methods is. It will also 
introduce a lot of subtle little misbehaviors when people mix the 
methods without thinking.

 From time to time you'll see them surface with questions like "Why does 
QByteArray give me the wrong byte?"

I'd rather have the compiler tell me that I need to change my code than 
hide it from me. Warnings are there for a good reason. The only way to 
do this with this proposal is to make count() deprecated from the start! 
So, why bother with duplicated API in the first place?


More information about the Development mailing list