Xref: utzoo gnu.g++.help:228 comp.lang.c++:10717 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!unido!danetis!engeln From: engeln@danetis.UUCP (Werner Engeln) Newsgroups: gnu.g++.help,comp.lang.c++ Subject: Re: initialization of objects within a library Keywords: c++,library,initialization Message-ID: <3346@danetis.UUCP> Date: 6 Dec 90 08:55:10 GMT References: <3306@danetis.UUCP> <1990Nov28.052118.11028@clear.com> Organization: Danet-IS GmbH, Stuttgart, West Germany Lines: 33 rmartin@clear.com (Bob Martin) writes: >You should never ever call a constructor or destructor yourself. The >compiler will do these things for you... >Let me recommend that you declare the variable "aFoo" as follows: > foo *aFoo; <--- as a pointer to a foo. >..... Junk taken out. >Hope this helps. This is no general solution. sometimes I have no pointers but REAL objects (like cin & cout in the AT&T istream & ostream library) >In article <3306@danetis.UUCP> you write: >>To ensure that global objects of a library is initialized befor its first >>use, I implemented a counter to maintain the number of translation units >>using it (see "the annotated C++ reference manual section 3.4, Ellis & >>Stroustrup).[example below] I only have this reference and don't know their mystic tricks to initialize cin and cout by use of a nifty_counter. Is Stroustrup telling lies, or is there any hidden C++ feature ?? -- Werner Engeln Phone: +49-711/736051 FAX: +49-711/736054 Danet-IS GmbH UUCP: engeln@danetis.uucp Waldburgstrasse 17 - 19 BITNET: engeln%danetis.uucp@unido.bitnet D-7000 Stuttgart 80 X.400: C=DE;A=DBP;P=DANET;O=IS;S=Engeln