Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object Browser and negative hex numbers
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00596369
Message ID:
00596459
Views:
26
>>>>I was looking for something in the object browser and notice following:
>>>>Constant wdAlertsAll = -1
>>>>Hex: -0x00000001, Bin: 11111111
>>>>Member of Word (cached).WdAlertLevel
The part that get me curious is
Hex: -0x00000001
I never encountered negative hex numbers before. Shouldn't it be?
Hex: 0xff
>>>
>>>If it's a DWORD, then it should be 0xFFFFFFFF. The binary representation you show is only a byte. Generally, bytes are unsigned, words and dwords can be signed or unsigned. Why the representation the way it is, I can only guess.
>>
>>My best guess is that the key is defined as a signed 8-bit integer, and when treated as a UCHAR, is represented by the value 0xFF
>
>Yep, I'd guess so. I think, as I mentioned in my other post to Sergey, that VFP interprets hex values as unsigned unless otherwise specified. Thus, -0x00000001 makes some sense.
Actually, VFP has representational problems at and above 0x80000000 - it'll convert it internally to a real, which is why I now recast hex value using BITOR() internally in ClsHeap as of the last released version. You can test this easily enough; try the following:
? 0xFFFFFFFF = -1
? BITOR(0xFFFFFFFF,0) = -1
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform