delorie.com/archives/browse.cgi | search |
From: | Claus Fischer <cfischer AT tcadcs6 DOT sc DOT intel DOT com> |
Newsgroups: | gnu.gcc.help,comp.os.os2.programmer.misc,comp.os.msdos.djgpp |
Subject: | Re: C++ constructor problem solved!! Read how, it might come in useful in your future programs! |
Date: | 20 Jan 1998 08:45:59 -0800 |
Organization: | Intel Corporation |
Lines: | 24 |
Message-ID: | <j5lafcr3xh4.fsf@tcadcs6.sc.intel.com> |
References: | <bWLoegW7sFse-pn2-bxyqvlUyVUyY AT localhost> |
<34C2817A DOT 5547BE86 AT alcyone DOT com> | |
<bWLoegW7sFse-pn2-Y8HSrHrj4UXy AT portA32 DOT Generation DOT NET> | |
NNTP-Posting-Host: | tcadcs6.sc.intel.com |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Gili wrote: > I found a second (and perhaps better) way of doing this. Now I use > "this->fstream.fstream(<parameters>". Perhaps this should be questioned in a standards newsgroup to completely clarify it; however, I want to guard you; even though this might work for a current version of your C++-compiler, it's quite likely not going to work for the final version. No matter which syntax you use to refer to fstream::fstream(<parameters>) as a constructor - and the above form is just a syntactical variation of accessing the constructor function - the compiler will probably be required by the standard to create a temporary object. I think, therefore, that the only reliable form to use the constructor explicitely would be one of the alternatives suggested by previous posts: either using a pointer to an external allocated fstream object, or using the special form of try syntax which has been suggested by a person who is apparently more knowledgeable in C++ than me:-) Claus Fischer Not speaking for Intel.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |