try catch throw

This is a discussion on try catch throw within the C++ Programming forums, part of the General Programming Boards category; Is there any efficiency drop when using these error-control keywords? Even in instances where they aren't controlling error?...

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

    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
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    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,789

    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, 05:30 PM
  2. Exceptions "try, catch, and throw Statements" ???
    By Loic in forum C++ Programming
    Replies: 2
    Last Post: 08-12-2008, 10:22 PM
  3. Throw Catch for External Program
    By dav_mt in forum C++ Programming
    Replies: 6
    Last Post: 04-19-2008, 10:52 AM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  5. Try...catch...throw or ifs?
    By Kylecito in forum C++ Programming
    Replies: 9
    Last Post: 03-02-2006, 10:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21