macro parameter names

Karl Heuer karl at haddock.ima.isc.com
Thu Nov 30 07:35:39 AEST 1989


In article <1989Nov27.223210.29880 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>In article <18672 at watdragon.waterloo.edu> afscian at violet.waterloo.edu (Anthony Scian) writes:
>>What about the library prototypes that are coded "int foo( int x, int y )"
>>when they should be "int foo( int __x, int __y )"?
>
>it doesn't look to me as if user identifiers of the same name can interfere
>with them.

I believe that
	#define x 0
	#include <stdlib.h>
	int main(void) { return x; }
is a strictly conforming program, but it would break if the header uses "x" as
an identifier.

However, I don't agree that this is a mistake in the document.  The prototypes
in the document are merely an anchor for discussing the semantics of the
function; they are not "examples" of how the vendor can legally implement the
header.  Note that prototypes are also supplied for functions that must be
implemented as macros.

Karl W. Z. Heuer (harvard!ima!karl or karl at ima.isc.com), The Walking Lint



More information about the Comp.std.c mailing list