__near Keyword

Note: See the Non-ANSI Keywords section in HC(S)08 Backend . The near keyword is a synonym for __near. The near keyword is only allowed when the -Ansi: Strict ANSI compiler option is present.

You can use the __near keyword instead of the __far keyword. Use the __near keyword when you must specify an explicit __near access and __far is the non-qualified pointer or when you must explicitly specify the __near calling convention.

The __near keyword uses two semantic variations. Either it specifies a small function or data pointer size or it specifies the __near calling convention.

Table 1. Interpretation of the __near Keyword
Declaration Allowed Type Description
int __near f(); OK __near function returning an int
int __near __far f(); error  
__near f(); OK __near function returning an int
int __near * __far f(); OK __near function returning a __far pointer to int
int __far *i; error  
int * __near i; OK __far pointer to int
int * __far* __near i; OK __near pointer to __far pointer to int
int *__far (* __near f)(void) OK __near pointer to function returning a __far pointer to int
void * __near (* f)(void) OK Pointer to function returning a __near pointer to void
void __far *__near (*__near f)(void) OK __near pointer to __far function returning a __far pointer to void

The topics covered here are as follows: