Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rutgers!uwvax!daffy!cat9.cs.wisc.edu!schaut From: schaut@cat9.cs.wisc.edu (Rick Schaut) Newsgroups: comp.lang.c Subject: Re: typedef vs #define Message-ID: <4368@daffy.cs.wisc.edu> Date: 27 Feb 90 05:36:48 GMT References: <8430@cbnewsh.ATT.COM> <1990Feb24.234433.14252@utzoo.uucp> Sender: news@daffy.cs.wisc.edu Organization: U of Wisconsin CS Dept Lines: 20 In article <1990Feb24.234433.14252@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: | | The #define is handled by the preprocessor, while the typedef is handled | by the compiler proper. (Actually, a less implementation-dependent way | of stating this is that the #define is handled in ANSI C translation | phase 4 while typedef is handled in phase 7.) In this particular case, | it will make little difference. However, consider: | | typedef int (*intfp)(); | intfp ptrarray[10]; Good example, but for those who aren't too adept at parsing C type declarations perhaps the following is a bit more clear: typedef int (*ptr_to_int_function)(); ptr_to_int_function funct_ptr_array[NUMFUNCTS]; -- Rick (schaut@garfield.cs.wisc.edu) "I'm a theory geek; we use Turing machines!"--Gary Lewandowski