Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / December 2003



Tip: Looking for answers? Try searching our database.

Minor bug

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hendrik Schober - 04 Dec 2003 19:58 GMT
Hi,

I have something like the following:

 template< typename T >
 bool f(const T& obj)
 {
   try {
     return getFlag(obj);
   } catch( const std::exception& x ) {
     throw MyException(x);
   }
 }

The compiler warns at the last closing } about
a missing return statement.

Is this a known issue or should I try to reduce
the code to a repro case?

Schobi

Signature

SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
 Scott Meyers

Thorrsten Froehlich - 05 Dec 2003 07:50 GMT
> Hi,
>
[quoted text clipped - 15 lines]
> Is this a known issue or should I try to reduce
> the code to a repro case?

Well, if getFlag throws something that isn't based on std::exception,
your program will fail. So the compiler is right; it has to warn you
about the missing return.

   Thorsten
Hendrik Schober - 05 Dec 2003 09:41 GMT
> > Hi,
> >
[quoted text clipped - 19 lines]
> your program will fail. So the compiler is right; it has to warn you
> about the missing return.

 Oh, yes, 'getFlag()' doesn't have a 'throw'
 specification!
 Thanks!

>     Thorsten

 Schobi

Signature

SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
 Scott Meyers

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.