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??
4 ответов
+ 5
compile time error
runtime error
+ 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.
+ 2
Those are the big categories yes however the language provides subcategories of each and you can always implement your own.
0
compile time and runtime errors... nothing more than that right...thanks James