Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.
I was writing on c++ and when i go to define a object from a class with the name "catch", i noticed this is a command such as "int" or "double" .
I wanna informations about "catch", because i curious about it.
Thanks.
Posted
Updated 2-Mar-12 10:22am
v3
Comments
Sergey Alexandrovich Kryukov 3-Mar-12 21:38pm    
Those are not "commands"...
--SA

'catch' is a reserved word, used in exception handling.

It allows for a function to abort processing in case of an error, in a safe manner.

When an exception is thrown, objects on the stack are properly unwound and their destructors called. The appropriate catch statement in the try / catch block is then executed to handle the error.
 
Share this answer
 
Please see:
http://en.wikipedia.org/wiki/Structured_exception_handling[^].

This is one of the most fundamental and important inventions in programming of all times and peoples, mostly pioneered by Barbara Liskov at al (http://en.wikipedia.org/wiki/Barbara_Liskov[^]).

Today, anyone using any imperative of functional programming but not using or understanding this part of technology cannot be considered as a software developer, software engineer or a programmer. Not in any sense. Never. Not in any circumstances. Learn it now. Learn it very well. No excuses. This is not hard to learn.

—SA
 
Share this answer
 
v3
Comments
Espen Harlinn 4-Mar-12 15:41pm    
5'ed! :-D
Sergey Alexandrovich Kryukov 4-Mar-12 18:59pm    
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900