RobertElderSoftware / recc

A collection of compiler, emulator and microkernel tools.
Apache License 2.0
243 stars 14 forks source link

Completion of error handling #4

Open elfring opened 9 years ago

elfring commented 9 years ago

Would you like to add more error handling for return values from functions like the following?

RobertElder commented 9 years ago

Yeah, the error handling right now is pretty much non existent. Once I get close to having the compiler work well for all of basic C89, and have some very detailed unit tests, then I'll starting adding some better error handling. For now instant and catastrophic failure using assertions works pretty well.

elfring commented 9 years ago

I suggest to avoid ignorance of return values a bit more.

Are you interested to apply aspect-oriented software development? How do you think about to encapsulate error detection and corresponding exception handling as a reusable aspect in your software?

RobertElder commented 9 years ago

Error recovery and handling is a complex topic, especially in a language like C, where you don't have exceptions. I have a few ideas for how I'll implement error handling, but for now I'm just going to rely on instant (and obvious) program failure when an error is encountered. Once the compiler is able to work with some non-trivial test cases and I can fix it to some good unit tests, I'll start refactoring the error handling to be more user friendly. Currently, it is expected that no error will occur during compillation, so it would always be best to test your program first with gcc or clang with full warnings. I'm not following any particular development processes other than following my own personal opinions and experience on software development.

elfring commented 9 years ago

How do you think about to improve static source code analysis also for your software?

Do you find information sources like the following useful?

RobertElder commented 9 years ago

Yeah, static analysis is something that I think about a lot. In the future, I'd like to build some of my own static analysis tools into the compiler. Currently, I only rely on static analysis that comes from the warning flags from gcc and clang.