On Nov 7, 2010, at 4:13 PM, Jakub Zawadzki wrote: > On Sun, Nov 07, 2010 at 03:37:36PM -0500, Hadriel Kaplan wrote: > > I really don't want to force it bigger than int, I just want to make it > unsigned. > > cause: > (gdb) call /x (unsigned long long) (0xdead << 16) > $1 = 0xffffffffdead0000 > (gdb) call /x (unsigned long long) (0xdeadU << 16) > $2 = 0xdead0000 > > and I'm afraid in your case (VENDOR_FOO << 16) is sign extended to uint64_t. > (btw. you can check it using disassembly)
Ahhh - yup, you're right! That did the trick. >> gcc errors that the switch's case statement is not an integer... and >> apparently ISO C agrees with it: switch/case is defined to use an int size > > Well mine[1] version of C99 standard speaks only about *integer constants*, > and unsigned long long constant is still integer one. > Can't find information about int size. > > gcc-4.4.4 compiles & run attached test without problem (both on -m32 -m64) > Can you try it? Yup, worked. > [1] http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf Right, but doesn't section 6.8.4.2 say it? Oh wait, you mean it says integer but it's a long long integer so it's ok. Weird... I know I got a compiler warning when I tried forcing it originally. Maybe I was using a variable after all instead of a constant. I'm usually good about not doing that, but I must've 'cause it's compiling fine now... spent too long pulling my hair out trying to figure out why my code wasn't working when I copied Cace Technology's example, to remember all the things I tried. Thanks! So maybe a comment should be added to sminmpec.h to do that for anyone adding VENDOR_xxx to the list? -hadriel ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <[email protected]> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:[email protected]?subject=unsubscribe
