Skip to main content

IAR Embedded Workbench for RL78 5.20

Data pointers

In this section:

The size of data pointers is always 16 or 24 bits. These data pointers are available:

Keyword

Pointer size

Address range

Description

__near

2 bytes

0xF00000xFFFFF

The highest 64 Kbytes.

__far

3 bytes*

0x000000xFFFFF

Entire 1 Mbyte address area.

__huge

3 bytes*

0x000000xFFFFF

Entire 1 Mbyte address area. Used for objects larger than 64 Kbytes.

Table 79. Data pointers  


* Because of alignment restrictions, 3-byte pointers take up 4 bytes in memory.

Segmented data pointer comparison

Note that the result of using relational operators (<, <=, >, >=) on data pointers is only defined if the pointers point into the same object. For segmented data pointers, only the offset part of the pointer is compared when using these operators. For example:

void MyFunc(char __far * p, char __far * q)
{
  if (p == q)  /* Compares the entire pointers. */
    ...
  if (p < q) /* Compares only the low 16 bits of the pointers. */
    ...
}