recursive typedef in c

Mark Plotnick mp at mit-eddie.UUCP
Mon Dec 26 08:56:34 AEST 1983


One of my favorite examples of C programming came from a compiler
course I took (AM295).  The staff supplied some skeleton C programs
that we had to modify, including one that contained:

#define	EXPRPTR	struct exprnode *

typedef struct exprnode {

	/*operator result*/
	    OPCLASS op;
	    EXPRPTR opleft;
	    EXPRPTR opright;

	/*subprogram call*/
	    char *spname;
	    EXPRPTR spargs;

#undef	EXPRPTR
} *EXPRPTR;

Groan.  My all-time favorite is the following statement-and-comment,
taken verbatim from the PWB/Unix pexec() library routine:

	argv[argc] = 2;		/* don't ask why */

I still don't know what it did.  Perhaps those of you who
participated in the argc[argv] discussion can help.

	Mark



More information about the Comp.lang.c mailing list