On Sat, Aug 15, 2020 at 10:59 AM John Reiser <jrei...@bitwagon.com> wrote: > > The fact that you write '0xc018786f' here, but '3222829167' in the code, > shows that you are not sufficiently paranoid. First, if the bit pattern is important > then you should write hex. If you insist on decimal, then you should write '3222829167u' > to remind yourself and the compiler that the value is unsigned; otherwise because > 3222829167 exceeds INT_MAX then a compiler is allowed to interpret it as -1072138129 > (or ANY VALUE WHATSOEVER!!!)
This is incorrect for C99 and indeed any compiler that supports "long long". On such systems, the integer constant 3222829167 has type "long long", and it is absolutely guaranteed to preserve that value when cast to unsigned. Assuming 32-bit int, of course. I agree it is poor style, but there is essentially zero chance it is causing a problem here. Although 32-bit vs. 64-bit confusion elsewhere certainly might. - Pat
_______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users