Opened 17 years ago
Last modified 13 years ago
#240 reopened Defect
Check return codes everywhere
Reported by: | elfring | Owned by: | davea |
---|---|---|---|
Priority: | Minor | Milestone: | Undetermined |
Component: | Client - Build | Version: | |
Keywords: | Cc: |
Description
Some checks for return codes are missing.
Examples:
Would you like to add more error handling for return values from "malloc" like in the function "read_ppm_file" and from "fwrite" in the function "copy_stream"?
Change History (9)
comment:1 Changed 17 years ago by
Component: | Undetermined → Client - Build |
---|---|
Owner: | set to romw |
comment:2 Changed 17 years ago by
Owner: | changed from romw to davea |
---|
comment:3 Changed 17 years ago by
Priority: | Major → Minor |
---|
comment:4 Changed 17 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 Changed 17 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I suggest to avoid unchecked function calls.
Would you like to detect every error situation as early as possible?
There are still some ignored error codes from functions like fread.
(By the way: Is it a bug that there is no break instruction at the end of "case '3':"? Is the fall-through really intended?)
comment:6 Changed 17 years ago by
Fall-throughs on switch blocks should always be noticed with a //fallthrough
comment in place of the break;
.
Also, it's clear it's not feasible to check error codes on every function call. That's why handling were invented. BOINC should really start using them...
comment:7 Changed 17 years ago by
Oops, the link on my previous comment is broken. I meant: That's whyexceptions were invented.
comment:8 Changed 17 years ago by
Each return value should be checked to see if an exception object should be thrown. Are there any situations where the reaction "exit(errno)" or "abort()" would be more appropriate?
Would you like to reduce the efforts for error code checking by an exception class hierarchy?
comment:9 Changed 16 years ago by
Milestone: | 6.6 → Undetermined |
---|
I added a few. Not feasible to do them all right now.