[openbeos] Re: Asserts?
- From: Scott Mansfield <thephantom@xxxxxxx>
- To: openbeos@xxxxxxxxxxxxx
- Date: Fri, 4 Oct 2002 16:15:51 -0700
On Thursday, Oct 3, 2002, at 20:34 America/Los_Angeles, Michael Phipps
Would you, as an app writer, want your app to *stop* if
the library writer has a bug?
Honestly, I'd be fa-bleeping pezzed off if a library were to assert,
throw, or whatever condition that would cause an unexpected termination
out of my control. My long-standing rule is that there should *never*
be an exit from a library, period. I wasn't sure of OBOS' standing on
the issue, this is why I chose to ping the group.
Asserts are really primitive exceptions for C.
I disagree, setjmp/longjmp is C's version of exception handling both in
behavior and use.
should be reserved for "I am internally screwed up in some way".
That's different from my vision of asserts. My vision of the purpose
of an assert is to trap errors during debugging cycles, before a
program is considered for 'release' status. I tend to think of asserts
as a tool to trap stupid programmer errors. For example, pointer
parameters being NULL when we expect them not to be, getting a divisor
that's zero, ad nauseum.
To me, "I am internally screwed up in some way" is the perfect time to
throw an exception, not assert.
Not trying to be confrontational, just engaging in lively discussion
with some of my peers. :-)
And thanks, Scott, for bringing it up...
No problemo, glad to stir things up a bit. :-)
In retrospect I never should have asked the question in the first
place, but I've been in "app mode" at work and it crept into my OBOS
coding efforts--couldn't context shift fast enough I guess. That, and
the allergy medication I'm taking has got me a little light headed the
past few days. ;-)
Other related posts: