Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion of error handling #28

Open
elfring opened this issue Jun 3, 2015 · 6 comments
Open

Completion of error handling #28

elfring opened this issue Jun 3, 2015 · 6 comments

Comments

@elfring
Copy link

elfring commented Jun 3, 2015

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

@browndeer
Copy link
Owner

Here it depends. In some cases return values are not checked for errors
simply because they were ignored during development, but should be
corrected to tighten up the code. In other cases, individual error codes
are not checked in favor of checks higher up, especially for code that
must be fast, so performance is favored over error specificity in very
unlikely scenarios, for example pthread_mutex_init, I do not consider this
likely to fail unless something is very wrong, in which case I will accept
a crash. This is a judgment call, and subject to debate, but everything
is a tradeoff. Finally, in some cases, for example, internal calls like
_do*() functions, there is deliberately minimal checking of parameters
since these should be checked at the layer above it, and the redundancy is
intended to be avoided. This does not address your question, but I would
say here also we prefer effective error checks, not a myriad of checks for
every small thing. Short answer, yes, but it depends.

-DAR

@elfring
Copy link
Author

elfring commented Jun 3, 2015

Would you like to detect every error situation as early as possible?

@browndeer
Copy link
Owner

browndeer commented Jun 3, 2015 via email

@elfring
Copy link
Author

elfring commented Jun 3, 2015

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

Do you find information sources like the following useful?

@browndeer
Copy link
Owner

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

Possibly. Can you recommend a tool that would be particularly good with
this type of software that we might take a look at?

Do you find information sources like the following useful?

To my understanding, the concept might be useful, but I would need to see
how it helps. We try to follow the FreeBSD design principles (adopted
from X11) so there will be resistance to a complicated solution when a
simpler one suffices. Also, and I am not quite sure I interpret this
correctly, but if the idea is anything like catch-throw semantics in C++,
this is not of interest and something I find to be quite bad in design.
The present error reporting system, while not fully built out perhaps, is
much preferred. I should say also, there is no interest in moving to a
C++ design at this layer, it will remain C. This is not an aversion to
C++, I use it for many other things, but not at this layer.

Thanks for the suggestions. I do appreciate them.

-DAR

@elfring
Copy link
Author

elfring commented Jun 4, 2015

I recommend to pick an improved analysis tool at all. 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants