Hi,

Il 07/05/19 16:08, Ola Røer Thorsen ha scritto:
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.

I see, and it's indeed mostly annoying. Again, out of curiosity, is the API forcing you to use a QByteArray coming from Qt itself?

Thanks,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to