static -> static near

Howard_Reed_Johnson at cup.portal.com Howard_Reed_Johnson at cup.portal.com
Wed Aug 3 15:54:47 AEST 1988


Someone asked a question about the difference between the 'static'
keyword and the 'near' keyword used in 80x86 compilers, viz.:

	What's the difference between these declarations?
		static int func() { return(0); }
		static near int func() { return(0); }

Using static in this context (outside a function) simply means
that the symbol referred to is not visible outside that source file.

The near qualifier instructs the 80x86 compiler to expect to be
called with a near call (as opposed to a far call).

The two are not equivalent, since the address of 'func' can be
given to other program modules via a pointer to function:

		int (*pfi)() = func;



More information about the Comp.lang.c mailing list