|
|||||||||||
Technical Support Support Resources
Product Information |
C51: Pointer Storage SizeInformation in this article applies to:
QUESTIONI have defined a pointer which points to a variable in XDATA memory. Why does the pointer takes up three bytes of memory, surely only two bytes are required? ANSWERYou are using a generic pointer. Generic pointers may point to any memory space (IDATA, XDATA, CODE, etc.). For example:
The first byte of the pointer indicates the type of memory the pointer points to. For example, 01H is xdata. The remaining two bytes are of course the address. You may declare memory-specific pointers instead of generic pointers if you want more efficient pointer operations. When declaring the pointer, include the memory area it points to. In the case of a pointer to XDATA, only two bytes are required for storage. For example:
The code generated by using a memory-specific pointer is smaller and faster than a generic pointer, however, the generic pointer may reference any memory area. Both memory-specific pointers and generic pointers may be stored in any memory area. MORE INFORMATION
SEE ALSOLast 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.