Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ames!haven!decuac!e2big.mko.dec.com!bacchus.pa.dec.com!decwrl!wuarchive!rex!ukma!usenet.ins.cwru.edu!abvax!iccgcc!browns From: browns@astro.pc.ab.com (Stan Brown, Oak Road Systems) Newsgroups: comp.lang.c Subject: Re: undefining a typedef Message-ID: <412.26c402c8@astro.pc.ab.com> Date: 11 Aug 90 18:06:16 GMT References: <1820006@hpsad.HP.COM> Lines: 27 In article <1820006@hpsad.HP.COM>, jose@hpsad.HP.COM (Jose Gomez-Rubio (SEED Student)) writes: > How does one undefine a typedef construction in a header file? > > The problem is that a specific typedef construction is declared > unconditionally in 3 separate header files in a source file that includes > those 3 specific header files. > > I've tried #ifndef foobar ... #endif and #if !defined (foobar) ... #endif > to no avail. The compiler still complains about redefinition of typedef > and refuses to continue. I don't have a good solution, but I can help explain the problem. #ifdef and #if defined()--which is really the same thing--ask whether PREPROCESSOR symbols are defined; i.e. whether the symbols have been #defined. A typedef is not a preprocessor symbol. What I do in these cases is something like this: #ifndef TYPE_MUMBLE_DEFINED typedef char *MUMBLE[ ]; #define TYPE_MUMBLE_DEFINED 1 #endif It's ugly, and I'd love to hear a better way. Stan Brown, Oak Road Systems, (216) 371-0043 The opinions expressed are mine. Mine alone! Nobody else is responsible for them or even endorses them--except my cat Dexter, and he signed the power of attorney only under my threat to cut off his Cat Chow!