trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: May 2012

Re: [trinity-devel] kipi-plugins patch (gcc 4.7 + libpng 1.5) [was Re: [trinity-devel] kipi-plugins FTBFS libpng 1.5 - fixed?]

From: Mike Bird <mgb-trinity@...>
Date: Fri, 4 May 2012 18:44:00 -0700
On Fri May 4 2012 18:29:35 Darrell Anderson wrote:
> > (iCCP_data)ICCColorProfile.data() is better replaced by
> >
> > static_cast<iCCP_data>(ICCColorProfile.data()).
> >
> > This also applies to the digikam patch.
>
> Trying to learn: why is that better?

Because the compiler can warn you if somebody changes a
declaration and the cast turns into something other than
a static cast.

It's better to use a static_cast, dynamic_cast, const_cast
or reinterpret_cast than the old-fashioned cast which can
try too hard when you'd rather have a warning.

--Mike Bird