> Could you make an example where the casts are needed? Maybe the code can > be rearranged in a way that the casts are NOT needed in the first place. > > QByteArray bytes; // chosen because some api needs it later std::vector<char> other_bytes; // maybe returned from some 3rd party library ... if (static_cast<std::size_t>(bytes.size()) >= other_bytes.size()) { ... }
I guess i could write stuff like const std::size_t byteSize = bytes.size(); if (byteSize >= other_bytes.size()) but then I rather prefer static_cast. Note that I'm not saying we should change everything in Qt to unsigned int, I think that might break a lot of existing application code out there. Just saying that sometimes a static_cast is needed. Cheers, Ola
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest