I just wanted to de-pointerize "m_outerColor", but I hit this code:

                if( m_outerColor )
                {
                        QRadialGradient gradient( centerPoint(), outerRadius() 
);
                        gradient.setColorAt(0.4, _p->pen().brush().color() );
                        gradient.setColorAt(1, *m_outerColor );

                        p.setPen( QPen( gradient, lineWidth(),
                                                Qt::SolidLine, Qt::RoundCap ) );
                }
                else {
                        QPen pen = p.pen();
                        pen.setWidth( (int) lineWidth() );
                        pen.setCapStyle( Qt::RoundCap );

                        p.setPen( pen );
                }

Would it be ok to rewrite the first line to "if(true)", or is there any case 
where the else block is needed? I can't tell since there is no comment in the 
code.


Am Sonntag, 6. April 2014, 22:51:20 schrieb Tobias Doerffel:
> I think messing with pointers always should be avoided as often as
> possible. In this specific case, it IMHO adds no value. Using pointers
> here increases code complexity and makes things more crash-prone.
> QColor is a very light-weight class (basically it's just an
> enumeration and a union of 5 16-bit integers) - just a few bytes more
> than storing just the pointer itself (64 bit).
> 
> Toby

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
LMMS-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lmms-devel

Reply via email to