On 07/20/2013 07:19 PM, Tom Breton (Tehom) wrote:
> It's a case that (now) shouldn't be logically possible.  IMHO it's better
> for a failure of this logic to be an immediately obvious failure, but I
> will of course conform to team standards.

   I'm not sure what those "standards" are, so don't conform yet.  We 
might need to set the standards now.

   Assertions only fire with a debug build, so preventing people from 
losing work is probably not that big of a deal.  If they are running a 
debug build, they should know better (save frequently).

   I think the bigger picture issue is that oftentimes code assumes that 
once the assertion fires, the program ends.  I think we need to at least 
take into account the fact that for a non-debug build, the assertion 
will not happen, and therefore we should be careful not to crash on the 
user.  And I think that's the real spirit of what I commonly see 
throughout rg:

if (p)
     p->foo();

   With this, we do no harm in a debug or a non-debug build if p happens 
to be 0.  Achieving the same with an assert is as simple as adding the 
assert:

Q_ASSERT_X(p, "bar()", "p shouldn't be 0");
if (p)
     p->foo();

   Of course, each case will be different.  But the idea is to handle 
things cleanly without the assertion.  Then add the assertion if you 
really want to crash on users of a debug build.

   We should use something like this as a starting point for a 
rosegarden assertion guideline.

   I think handling problems cleanly in debug and non-debug builds is 
easy to agree on.  Whether assertions should be allowed might be a bit 
harder to agree on.

   On the upside, assertions do grab our attention so that we address 
the issue.

   On the downside, assertions are crashes that cause data loss, but 
only in a debug build.  Is anyone seriously morally opposed to this?

Ted.

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to