Important: Please read the Qt Code of Conduct -

Qt turning off important GCC / Clang warnings?

  • Hello people!

    In this last week I've discovered some annoying things about Qt and the project I'm working on for years. Days ago I received a pull request at GitHub that enables my project to be built in Visual Studio. I was very happy to see such improvements in action but as I started to explore the new code my nightmare began!

    I usually compile my project using GCC and Clang to check different warnings and errors. I fix all warnings that both compilers display as soon as possible. But when I tried the first time to compile the patched version of my project in Visual Studio the compiler started to spit out a lot of warnings related to integer casts that leads to possible data loss (for instance converting size_t to unsigned). I Googled a bit and discovered that -Wconversion and -Wshorten-64-to-32 are the options that enables such warnings and Qt does not bring them on in Linux, Windows (MingW) and MacOSX bundles. When I forced such warnings for my surprise and desperation a lot of Qt headers triggers them and my project's source too! :(

    Well, my project has ~90K lines of code and I'm not willing to fix those warnings for now (maybe never fix them!)... I tried twice and accidentally introduced bugs so I reverted back to the original code. My questions are: 1) Why does Qt disable such warnings? 2) Someone has some thoughts or words from framework developers?

    I know that implicit cast can be harmless in several scopes but what I can't understand is why disable the warnings!? :(


    P.S.: Sorry my bad English.

  • Moderators

    Hi @rkhaotix,

    I don't know the answer. However, I recommend that you subscribe to the Interest mailing list and post your question there. Qt engineers are active on that list, but they won't see your post in this forum.

Log in to reply