Page last updated 04/21/99
Categories of errors and warnings are detected during implementation
You've probably experienced many errors, especially those detected at compiletime
The above is listed in order of difficulty in resolution.
Generated while the compiler is processing the source code.
Compiler reports violations of syntax rules. For example given these general forms (syntax rules):
What should the compiler do when it is processing this source code?
int student Number; cin >> student;
The compiler generates warnings when it discovers somethings that is legal, but potentially problematic
Example:
double x, y, z ; y = 2 * x ;
// Warning: x used before being initialized
// Warning: z declared but never used
Errors that occur while trying to put together (link) an executable program
For example, we must always have function main (Main or MAIN won't do).
Errors that occur at runtime, that is, while the program is running.
Examples: Invalid numeric input, division by 0, picking up a cookie that is not there.
When the program does what you typed, not what you intended.
Imagine this code
cout <<"Enter sum: "; cin >> n; cout <<" Enter n: "; cin >> sum; average = sum / n;
Whose responsibility is it to catch this error __ ?
If none of the preceding errors occur, the program may still not be right.
The working program may not match the specification because either