Preprocessor question (is gcc standard)?

Dan Barrett barrett at jhunix.HCF.JHU.EDU
Wed Feb 27 09:53:45 AEST 1991


	GCC's preprocessor doesn't like this code:

		#include <ctype.h>
		#define ARGS		(x)

		main()
		{
			...	isalpha ARGS ...
		}

The linker complains that _isalpha is not known.  According to H&S and K&R,
you are allowed whitespace between the name of a macro and its argument list
in the invocation.

	GCC's documentation says that a macro invocation that is not
followed by a left parenthesis (ignoring whitespace) is not considered a
macro invocation.  That explains why GCC doesn't like the above program.
But is this the standard way an ANSI preprocessor should work?  I can see
advantages and disadvantages to this behavior.

                                                        Dan

 //////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
| Dan Barrett, Department of Computer Science      Johns Hopkins University |
| INTERNET:   barrett at cs.jhu.edu           |                                |
| COMPUSERVE: >internet:barrett at cs.jhu.edu | UUCP:   barrett at jhunix.UUCP    |
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////



More information about the Comp.lang.c mailing list