__near Keyword

The near keyword is a synonym for __near. The near keyword is only allowed when the -Ansi: Strict ANSI compiler option is present.

The __near keyword can be used instead of the __far keyword. Use it in situations where non-qualified pointers are __far and you want to specify an explicit __near access or when you must explicitly specify the __near calling convention.

The __near keyword uses two semantic variations. Either it specifies a small size of a function or data pointers 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