Definition of error types

Status
Not open for further replies.
J

jjimenez101

Guest
Hello all,

What is the difference between a run-time error and a compile time-error?
 
You pretty much answered your own question.
Run times error occur when you run the program.
Compile time errors occur when you compile the program.
 
Sceadwian said:
You pretty much answered your own question.
Run times error occur when you run the program.
Compile time errors occur when you compile the program.


That's obvious..... Although I appreciate the response Sceadwian but is there a more specific detailed descpription? Also, in a run-time error, I would assume that the compiler did not "catch" the error, and at run-time it was "caught". If this is so, what would make the error not be "seen" by the compiler at compile time but "caught" at run-time.

For example, a syntax error is one that the code is incorrect in some way in terms of, well --syntax. This would obviously be "caught" when compiling the program. But what exaclty is a run-time error and how would the programmer know by looking at code that there will be a run-time error when the program runs??

Thanks.
 
A run time error would be like a buffer over flow, compilers won't catch those as they only occur during run time. Modern programs are rife with buffer over flows it's one of the single easiest fatal mistake that can easily slip past a programmer, it's also how a good deal of virii are spread as if a buffer overflow occurs at the wrong spot under certain conditions the bytes that were overflowed will be executed.
 
How about a classic math run time error that uses two variables. At compile time the compiler has no idea what value may be in a specific variable when the math operation is performed at run time, you may indeed due to programmer error (the human one!) try to divide a variable by zero, which should generate a run time error depending on the math libary used.

Some run time errors can be prevented by code that checks operations before calling functions or checks user inputs for proper value(s) or format.

Lefty
 
jjimenez101 said:
But what exaclty is a run-time error and how would the programmer know by looking at code that there will be a run-time error when the program runs??

Thanks.

A program can have no compiler errors and still generate errors when they are run. These are run time errors. They include division by zero, stack overflow, problems related to banked memory, and improper memory allocation.

Run time errors can not be found by looking at the code. They can be found by "running the code by hand" or with a good simulator or real time debugging that can do breakpoints and/or trace execution.

Run time errors can be much more difficult to find.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…