Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!uunet!taumet!steve From: steve@taumet.COM (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: extern const definition Keywords: extern const Message-ID: <240@taumet.COM> Date: 4 Jun 90 17:31:17 GMT References: <612@atcmpe.atcmp.nl> Reply-To: steve@taumet.UUCP (Stephen Clamage) Organization: Taumetric Corporation, San Diego Lines: 26 In article <612@atcmpe.atcmp.nl> leo@atcmp.nl (Leo Willems) writes: > >This C++ code compiles under 1.2, 2.0 (both Glockenspiel) and Zortech (2.06): > extern const int eof = -1; >The C generating cfront compilers both emit multiple definitions for eof >from which the c compiler gets a headache. You should use extern const int eof = -1; in exactly one place, and extern const int eof; everywhere else. This way you have exactly one defining instance. Alternatively, use const int eof = -1; everywhere. >Must ANSI C compilers accept this: > int eof = -1; > int eof = -1; Absolutely not. An ANSI C conforming program will have exactly one defining instance (that is, with an initializer), and the remainder will be extern declarations. -- Steve Clamage, TauMetric Corp, steve@taumet.com