On Mon, Aug 25, 2008 at 2:29 AM, Giel van Schijndel <[EMAIL PROTECTED]> wrote:
> Hmm, the "program defefensively" I've learned to know means "try to
> *detect* and handle every/most errors" it doesn't mean recovering from
> them. That's just a terminology issue though, so don't interpret that
> last sentence as an attempt to start a flamewar.

The way I see it, there are basically two schools of C programming:
 - The assert school: Check results with asserts, and try to abort as
early as possible to generate useful bug reports. This leads to faster
detection and quicker fixes of bugs since the problem is identified
earlier and with less uncertainty (nobody can argue that a crash is
not a bug), and a backtrace will zero in the problem area. Gnome, for
example, do this.
 - The defensive programing school: The program should not crash.
Period. Check results and on failure, clean up local state and return
an error value to the calling function. The program should continue to
run if at all possible, and restart if not.

I would like us to follow both schools. We should assert in debug
builds, and recover in non-debug builds.

  - Per

_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to