Ticket #240 (reopened Defect)

Opened 1 year ago

Last modified 1 year ago

Check return codes everywhere

Reported by: elfring Assigned to: davea
Priority: Minor Milestone: 6.4
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

06/06/07 09:00:42 changed by Ageless

  • owner set to romw.
  • component changed from Undetermined to Client - Build.

06/06/07 10:18:10 changed by Ageless

  • owner changed from romw to davea.

07/10/07 12:06:23 changed by davea

  • priority changed from Major to Minor.

I added a few. Not feasible to do them all right now.

07/13/07 12:41:54 changed by davea

  • status changed from new to closed.
  • resolution set to fixed.

09/06/07 05:20:52 changed by elfring

  • status changed from closed to reopened.
  • resolution deleted.

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?)

09/06/07 06:39:56 changed by Nicolas

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...

09/06/07 06:47:30 changed by Nicolas

Oops, the link on my previous comment is broken. I meant: That's whyexceptions were invented.

09/10/07 01:12:50 changed by elfring

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?


If this page is incomplete or incorrect, please edit it or add it to the wiki to-do list. To do this, you must be logged in; click Login or Register above.