Re: Trying to use gdb on OS X
- Posted by jaygade Jun 10, 2013
- 3210 views
I might be overthinking this a bit. I need to write this out to wrap my head around it:
1. double contains a positive value in the integer range (0x00000000 - 0xFFFFFFFF). Conversion to unsigned long should be converted correctly. Conversion to signed long should fail if the double is greater than 0x7FFFFFFF.
2. double contains a negative value in the integer range (0x80000000 - 0xFFFFFFFF). Conversion to unsigned long should fail (implementation defined - I was getting 0 when testing above). Conversion to signed long should be okay.
When going to unsigned (which we generally want for bit and address manipulation) the key difference is the sign of the double is handled.
Looking at Matt's example up above, it looks like test 1 holds true. Test 2 converts to both unsigned and signed correctly in Matt's example (for -1), but I think on OS X it will fail.