|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: Far Var _at_ Compared to Cast ValueInformation in this article applies to:
SYMPTOMThe following function:
always returns a zero ('0') even though it should return one ('1'). CAUSEAddresses specified with the _at_ are converted into a memory type byte + offset combination. So, the variable located using _at_ 0x021234 has an address of 0x031234. Values cast into an address are assumed to have the correct memory type byte + offset combination. So, the type cast (void far *) 0x021234L has an address of 0x021234. Based on these conversion rules, these two addresses are not identical. And, the function returns a zero ('0'). RESOLUTIONThe best way to resolve this issue is to use the FVAR macro from ABSACC.H in place of the type cast: &FVAR(char,0x021234). For example:
Another way to resolve this issue is to change either the _at_ address to 0x011234 or change the type cast to 0x031234. But don't change both. For example:
MORE INFORMATION
SEE ALSO
Last Reviewed: Thursday, February 25, 2021 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.