[comp.lang.c] How About #define foo foo

tanner@ki4pv.UUCP (02/13/87)

It is interesting to note that some progs notice constructions where
a macro is defined to be itself, such as csh noting "alias foo foo".

Would it be desirable for the pre-processor to do something similar,
so that the following construction might work?

#ifndef	foo
typedef	int	(*foo)();	/* my fancy type */
#define	 foo	foo		/* remember that we know it */
#endif

Just curious.  Compiler here blows out on the above (expansion too
big), but I'd be interested to hear of other reactions to it.
-- 
<std dsclm, copies upon request>	   Tanner Andrews

meissner@dg_rtp.UUCP (02/24/87)

In article <6938@ki4pv.UUCP> tanner@ki4pv.UUCP writes:
> 
> Would it be desirable for the pre-processor to do something similar,
> so that the following construction might work?
> 
> #ifndef	foo
> typedef	int	(*foo)();	/* my fancy type */
> #define	 foo	foo		/* remember that we know it */
> #endif
> 
> Just curious.  Compiler here blows out on the above (expansion too
> big), but I'd be interested to hear of other reactions to it.

This is the proposed ANSI draft.  The rationale for it is to allow a macro
function which calls the real function by the same name.  Reiser based
C preprocessors generally blow up on this.
-- 
	Michael Meissner, Data General	Uucp: ...mcnc!rti-sel!dg_rtp!meissner

It is 11pm, do you know what your sendmail and uucico are doing?