Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!husc6!mailrus!cornell!uw-beaver!uw-june!uw-entropy!dataio!bright From: bright@Data-IO.COM (Walter Bright) Newsgroups: comp.lang.c++ Subject: Re: Global constructors and C++ I/O streams; problems and questions. Message-ID: <1720@dataio.Data-IO.COM> Date: 24 Oct 88 18:18:08 GMT Article-I.D.: dataio.1720 References: <5955@columbia.edu> <386@fenix.Atlanta.NCR.COM> Reply-To: bright@dataio.Data-IO.COM (Walter Bright) Organization: Data I/O Corporation; Redmond, WA Lines: 36 In article <386@fenix.Atlanta.NCR.COM> tek@fenix.Atlanta.NCR.COM (Tom Klempay) writes: >In article <5955@columbia.edu>, beshers@select.columbia.edu (Clifford Beshers) writes: << The following program suffers a memory fault before it ever gets << to the first line of main(). The problem lies in the constructor << of the global instance 'example hello'; the reference to the << cout stream occurs before the initialization of that stream. << #include << struct example { << example() { cout << "Hello, world\n"; } << }; << example hello; // Comment out this line and it works, of course. << main() { cout << "We never get to the first line...\n"; } foo