On Saturday 07 June 2003 06:25 am, Guillaume Laurent wrote:
> On Saturday 07 June 2003 12:31, Levi Burton wrote:
> > Would the gui/ code benefit from things such as the assert() macro?
>
> Depends on what you have in mind. 

Well, I guess my thoughts went something like this -- checking pointers for 
implicit assumptions they are not null, and when they are, terminating the 
program then and there, with line information and all that jazz.  

For instance, 

SegmentTool* SegmentToolBox::createTool(const QString& toolName)
{
    SegmentTool* tool = 0;
    QString toolNamelc = toolName.lower();
    
    if (toolNamelc == SegmentPencil::ToolName)
        tool = new SegmentPencil(m_canvas, m_doc);

    assert(tool != NULL);  // tool should never be null

    m_tools.insert(toolName, tool);

    return tool;
}

So, basically checking every assumption that *pointer is not null with an 
assert().  I am guessing thats a shit-load of work.

> So what's left is to try to recover
> as nicely as possible from an internal error condition (null pointer tool,
> whatever) while reporting it. That generally means

Ok I think I see what your saying here and yes that makes sense.  So, that 
kind of invalidates my argument above.  Assert() will be effectively disabled 
in production code, leaving the user with no usefull information to provide 
the developers for fixing the problem.  That would suck. 

-- 
Levi Burton
http://www.puresimplicity.net/~ldb/



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Rosegarden-devel mailing list
[EMAIL PROTECTED] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to