// good macro is the one working
#define SET_GOOD(pt)( pt = pt | 0x8000000000000000LL)
#define SET_FAIL(pt)( pt = pt | 0x8000000000000000LLU)
// Qt typedefs from qglobal.h
typedef long long qint64; /* 64 bit signed */
typedef unsigned long long quint64; /* 64 bit unsigned */
// suggested "u" to change from 0x35 to 0x8000000000000035
quint64 u = 0x35;
SET_FAIL(u); // "u" becomes 0 instead
// suggested "s" to change from 0x35 to 0x8000000000000035
qint64 s = 0x35;
SET_GOOD(s); // "s" becomes 0x8000000000000035
The idea is that we needed bitfield to contain some numbers and flags which are 64 bit summary, First we decided that unsigned type is better because it is likely to be the most hardware-native and sign independent. Any way after some experiments we came to the facts above and started to use signed int64 format which is ok. Never the less under MSVS compiler both macros work as designed.
We are sure this is a bug, since it not only refuses to work correctly but even spoils data (to 0 as described).
Qt 4.8.1 for Desktop - MinGW (Qt SDK)
Using built-in specs.
Configured with: ../gcc-4.5.2/configure --enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-r
untime-libs --disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.2 (GCC)
GNU ld (GNU Binutils) 2.21.1
Log in to post a comment.