Nominate our 2022 Qt Champions!

Quint64 initialisation without Q_UINT64_C

  • Hi

    I have a 64 bit integer initialized like this:
    @quint64 myInt = 18446744073709550616;@

    I get no compiler error (MSVC2010-32bit). However the documentation on this says:

    typedef quint64
    Literals of this type can be created using the Q_UINT64_C() macro:
    quint64 value = Q_UINT64_C(932838457459459);

    Even though I have no compiler error with regular initialization, I wonder if I should use Q_UINT64_C to make the code cross-platform safe? Ex:
    @quint64 value = Q_UINT64_C(18446744073709550616);
    quint64 value = Q_UINT64_C(0);@

Log in to reply