What are the types of errors the compiler throws on execution of a Cpp program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What are the types of errors the compiler throws on execution of a Cpp program?

when compilation error occurs and when run time error occurs??are there àny other error that the compiler throws?? what is the purpose of the try...catch in CPP??

10th Jan 2017, 7:01 PM
Sai Krish
Sai Krish - avatar
4 Answers
+ 5
compile time error runtime error
10th Jan 2017, 7:09 PM
Nawaj Shareef
Nawaj Shareef - avatar
+ 2
There are two main categories of exceptions in C++. The first is compile time and relates to structural and type errors that prevent the compiler from outputting some kind of binary. You cannot try/catch this. Depending on the error you can disable the error via a command line flag or you must fix the offending code. Runtime exceptions occur when some exceptional state is reached while executing your code. A simple example of this would be when you try to divide by zero. You can use the try/catch block to handle this code if you think it is a possibility. Try/catch is just a way of gracefully handling errors while your program is running.
10th Jan 2017, 7:05 PM
James Durand
James Durand - avatar
+ 2
Those are the big categories yes however the language provides subcategories of each and you can always implement your own.
10th Jan 2017, 7:10 PM
James Durand
James Durand - avatar
0
compile time and runtime errors... nothing more than that right...thanks James
10th Jan 2017, 7:08 PM
Sai Krish
Sai Krish - avatar