Thread: try catch throw

  1. #1
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490

    try catch throw

    Is there any efficiency drop when using these error-control keywords? Even in instances where they aren't controlling error?

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Essentially a throw is just a return of an object, and it's just as efficient as that.

    It is recommended to not use exceptions except when signalling errors, though. It provides no benefit, and has pitfalls -- exception safety has to be designed for from the ground up.

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: try catch throw

    Originally posted by ygfperson
    Is there any efficiency drop when using these error-control keywords? Even in instances where they aren't controlling error?
    There are a few overheads for exception handling even if an exception isnt thrown. They are pretty modest though, and unless you are pushing the efficiency of your overall code to the maximum, you shouldnt really be bothered by it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 04:30 PM
  2. Exceptions "try, catch, and throw Statements" ???
    By Loic in forum C++ Programming
    Replies: 2
    Last Post: 08-12-2008, 09:22 PM
  3. Throw Catch for External Program
    By dav_mt in forum C++ Programming
    Replies: 6
    Last Post: 04-19-2008, 09:52 AM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  5. Try...catch...throw or ifs?
    By Kylecito in forum C++ Programming
    Replies: 9
    Last Post: 03-02-2006, 10:41 PM