Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!ima!dirtydog!karl From: karl@ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Why have xxx_t typedef names (was Re: Is typedef char BUFFER[20] legal?) Message-ID: <1991Feb14.040136.27388@dirtydog.ima.isc.com> Date: 14 Feb 91 04:01:36 GMT References: <1212@tredysvr.Tredydev.Unisys.COM> <1991Jan29.210100.8105@zoo.toronto.edu> <1991Jan31.172147.21397@zoo.toronto.edu> <23134@netcom.COM> <3377@unisoft.UUCP> Sender: news@dirtydog.ima.isc.com (NEWS ADMIN) Reply-To: karl@ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 25 In article <3377@unisoft.UUCP> greywolf@unisoft.UUCP (The Grey Wolf) writes: >Is there/will there ever be a compile-time / cpp-time evaluation as to >what types are defined? For example: >#if typed(stat_t) ... Unlikely. In the traditional implementation, the preprocessor has no way of knowing anything about declared types. >This would eliminate the need for putting that stuff in .h files like >#ifndef _STAT_H_ A simpler solution would be to make typedefs idempotent, like macros. (Since a conforming implementation must already handle nested-scope typedefs like typedef int foo; void f(void) { typedef int foo; } I doubt that handling same-scope typedefs correctly would be any worse.) Unfortunately, ANSI didn't define it that way, so the best you can do in a portable header is to use a guard macro. >Also, do typedefs ever make it into an object's/executable's nlist? I believe some compilers will do this if debugging is enabled. Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint