Tuesday, January 25, 2011

The autopsy Part2

The solution? You have to reedit the source code file and fix what’s wrong. In this case, you would reedit ERROR.C and add the semicolon to the end of Line 5. Even if you looked at Line 6 (per the output’s insistence), you would see nothing wrong there. If so, your eyes would wander back and — because you’re aware of the Missing Semicolon Syndrome — you would see the prob­lem and mend it.


Errors are not the end of the world! Everyone gets them.
Syntax refers to the way a language is put together. Some compilers use that term rather than parse, which means “the order in which things are put together.” Eh.
Some versions of GCC put double quotes around “return” rather than the tick marks shown in the preceding example. Beyond that, GCC is
remarkably consistent with its error messages.
Missing semicolons are one of the most popular types of errors in the C language. You find out in the next chapter more about semicolons and the role they play.
The error message’s line number refers to a line in the source-code text file. That’s why nearly all text editors use line numbers, which you can see at the top or bottom of the screen or editing window.
The line number may or may not be accurate. In the case of a missing semicolon, the next line may be the “error line.” This statement holds
true with other types of errors in C. Oh, well — at least it’s close and not a generic honk of the speaker and “ERRORS GALORE, YOU FOOL” plas­tered onscreen.
A good habit is to fix the first error listed and then recompile. Often, the first error is the only real one, but the compiler lists others that follow
because it becomes confused.
Of course, you may be thinking “Okay, smarty-pants computer, you know what’s wrong — fix it!”

But computers don’t just jump to conclusions like that. That is the evil of the statement “Do what I mean”: Computers can’t read minds, so you must be precise. They are champs, however, at point­ing out what’s wrong (and almost snobbishly so).

Welcome to reproduce this passage. Please indicate the source when you reproduce this passage.

No comments:

Post a Comment