Message-ID: <37027D17.ABC61941@jps.net> Date: Wed, 31 Mar 1999 11:52:55 -0800 From: Dennis Yelle X-Mailer: Mozilla 4.51 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: try, throw, and catch -- is this a bug? References: <370121EB DOT 33506B4E AT jps DOT net> <922852481 DOT 604485 AT neptune DOT uniserve DOT ca> <7dsp3a$cds$1 AT nnrp1 DOT dejanews DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 209.239.207.88 X-Original-NNTP-Posting-Host: 209.239.207.88 X-Trace: 31 Mar 1999 20:14:16 -0800, 209.239.207.88 Lines: 68 X-Original-NNTP-Posting-Host: 209.63.224.240 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Willem D wrote: > > In article <922852481 DOT 604485 AT neptune DOT uniserve DOT ca>, > "DarkSun" wrote: [...] > > I see your problem... try changeing the prog to this : > > #include > > #include > > > > class sorry{ > > public: > > const char *error_msg; > > sorry( const char *p) : error_msg(p) {} > > }; > > > > int main() > > { > > try { > > throw sorry( "test 3"); > > } > > catch ( sorry stuff ) { > > cerr << "Sorry, "; > > cerr << stuff.error_msg ; > > cerr << '\n'; > > } > > cout << '\n'; > > } I did, it gets the same warning message on the same line. > Hi DarkSun, The difference between a class and a struct is nada! Although, I > agree fully with you - and use the class keyword in these instances - it > seems to be a matter of preference. Maybe someone knows what the ANSI C++ > standard specifies -- can a struct have functions according the the standard? Bjarne Stroustrup's book The C++ Programming Language Third Edition says, "A _struct_ is simply a _class_ whose members are public by default." at the top of page 226. Thus: class X { is equivalent to this: struct X { private: and: class Y { public: is equivalent to this: struct Y { > BTW: Your proposed fix does not work, Dennis' problem remains. It looks like > a bug to me, albeit a small one. Yup. What is the proper place to report bugs? I have a couple more cases of incorrect warnings being generated that I would like to report. Dennis