How About #define foo foo 
Author Message
 How About #define foo foo

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



Mon, 20 Jul 1992 20:33:00 GMT  
 How About #define foo foo

Quote:

> 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?



Mon, 20 Jul 1992 10:01:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. makefile question - foo.c := DUMMY=foo

2. sizeof(foo) -1 or sizeof(foo)

3. newbie question: foo.exe ->foo.c ??

4. difference between void foo(void) and void foo()

5. extern char *foo vs. extern char foo[]

6. (foo == (foo_t *)NULL) vs. ((void *)foo == NULL)

7. vararg in #define foo(a,...)

8. #define foo() bar /* ANSII legal?

9. #define foo() bar /* ANSII legal? */

10. #define foo() with variable argument lists

11. #include "foo" vs #include <foo>

12. char foo[]=""; vs char* foo="";

 

 
Powered by phpBB® Forum Software