On 1/9/22 12:15, Marc Mutz wrote:
This should be non-issue for function parameters, because widening isn't
an error. The value is less pronounced for return values, because
widening those may cause narrowing in user code, but the hope is that
once we've progressed somewhat, we can enlist compiler support by
globally enabling warnings such as -Wshorten-64-to-32, even though, as
the porting guide included in the
https://bugreports.qt.io/browse/QTBUG-102461  epic describes, this will
not catch manual casts, which is why, sadly, one needs to look at every
int/uint manually.

Sorry for bringing this thread back up from the archives.

So, named casts (static_cast) are better in such cases, as searching for them in source code is much easier than searching for:
- int(foo)
- (int)foo
- (int)(foo)

multiplied by the number of other integral types in Qt (qint32, qint64, uint, qlonglong, qulonglong... etc).

Thanks,
Ahmad Samir

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to