typedef vs #define

edward.man em at cbnewsh.ATT.COM
Sat Feb 24 04:58:52 AEST 1990


Is there any compiler writer out there? I have a C question that's
best answered by C compiler writers. Of course other C experts
can also provide insights and comments. However, I am looking for
a sure answer. The question is:

Consider the following two C statements:
	typedef short	FLAGS
	#define FLAGS	short

If I had two identical pieces of code, one used the "typedef" and
ther other "#define" as defined above, would there be any difference
in the compiled code? Does the C compiler handle the two differently?

I know "#define" is handled by cpp and the compiler never sees FLAGS.
How is "typedef" handled, by cpp or the compiler?

Ed Man
AT&T Bell Laboratories
att!hotlf!man



More information about the Comp.lang.c mailing list