Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

normalize pointer

Status
Not open for further replies.

ascht

Programmer
Sep 22, 2000
43
CH
Is it necessary to normalize pointers before comparism in VC++?
( In C it was, because pointer to the same place could have different
segment and offset addresses)
 
It depends on the type of the pointer you are using. If u are using a far pointer, then u should be normalizing but not the case for a huge pointer.

If you add values to a far pointer, only the offset is changed. If you add enough to cause the offset to exceed FFFF (its maximum possible value), the pointer just wraps around back to the beginning of the segment. For example, if you add 1 to 5031:FFFF, the result would be 5031:0000 (not 6031:0000). Likewise, if you subtract 1 from 5031:0000, you would get 5031:FFFF (not 5030:000F).

Sriks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top