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: /dev/ammo42 <mickeytintincolle@...>
Date: Sat, 5 May 2012 06:43:04 +0200
On Fri, 04 May 2012 22:49:46 -0500
"David C. Rankin" <drankinatty@...> wrote:

> On 05/04/2012 08:44 PM, Mike Bird wrote:
> > 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.
> 
> Right now, the compiler will not accept it though. You get a FTBFS
> with the 2nd patch, the first patch builds fine. How do we fix the
> 2nd patch?

Actually reinterpret_cast is necessary here. The following code compiles
on my system (but not if I use static_cast instead):

int main (int argc, char** argv)
{
return *(reinterpret_cast<unsigned char*>(*argv));
}