**Errors are really annoying after editing source code.** Badly, for a complete awareness of errors, compiler or some interpreter is obliged to feedback *every detail* in its error report. If it reports about 10+ lines, it is becoming annoying as error itself.
**Errors are inevitable, at least for beginners.** For example, when my classmate demonstrate a C++ snippet in the old version of *MSVC++ 6. 0*, for some reason, 18 errors pop out on the screen, which make everyone insane. Moreover, semi-programmers borrow and modify code in the modern time, such as in the area of physics, chemistry or math. They are afraid of huge amount of errors too. They, including me, need to know what hell is the error-feedback really talking about **in one sentence**.
**How to read errors and make use of it for us?** Taking C++ as an example, how to address one sentence
error feedback?
- Firstly, if error exsits, output the error into a file, in linux, we can say,
- Then, extract lines that only contain keyword like "error", in linux, we can say,
`cat Compile_Error | grep -in error`.
- Finally, modify the source code and continue doing this.
In this way, we can resolve some non-intelligent errors very quickly by reducing every error item into one line. Similarly, **is there any more suggestion on how to reduce C++ error information from compiler like g++/gcc into less lines so that errors are explicitly located?**
It doesn't matter how many errors you see, most of them are consequences of earlier errors. So only fix the first one or two and recompile. They'll disapper very quickly.
Hey;
Thumb rule is treat your warnings as errors.
Make sure you have 0 errors and 0 warnings.
Use some SCA (Static code analysis tool) to fix hidden warnings and erors.
if you are using VS,
VS 2012 have inbuilt SCA for both managed and unmanaged code.
After SCA do a self code review, whether one line or 100 lines of code followed by a 2nd person review whether changed a code or comment.
This will ensure that the file changed has not introduced new errors or warnings.
After review a self testing of the written code vs tthe requirement that you have worked for.
**Errors are really annoying after editing source code.**
Who says they are annoying.
Perhaps it's better to be grateful for every error message or warning issued by the compiler, as it is providing valuable assistance in avoiding certain flaws or defects. The compiler is there to help you write good-quality code, not an obstacle placed in your path.
@Chervil Of course. We learn from errors. Your are right. That's why I want to make better use of it by focusing only on errors. My real concern is about the way how error is presented. The g++ error presentation is a little more than annoying. That's why I need to filter error message myself. Sorry for not expressing it explicitly.