gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-dev] Re: [PATCH] libamf/lcshm.cpp: fix "cast loses precision"


From: Benjamin Wolsey
Subject: Re: [Gnash-dev] Re: [PATCH] libamf/lcshm.cpp: fix "cast loses precision" error
Date: Sat, 25 Jul 2009 16:48:33 +0100

> Indeed. Just like %p is better coding style than 0x%x. But as this was
> rejected yesterday, I tried it minimalistic this time. Whatever I do
> seems wrong.  :-P
> 

I don't know what the defensive tone is for. Indeed 0x%x is wrong as it
will print "0x0x0" instead of "0x0" for pointer arguments, but %x is
just as effective as %p or indeed %s or, perhaps best of all anywhere
for boost::format, %1%. Your patch for this was fine; I wanted to make
clear that a) printf isn't involved and its formats are irrelevant and
b) casting pointers to any particular integral value is wrong. Had all
this been as obvious as you think, it wouldn't have been in trunk in the
first place. The patch wasn't 'rejected' either, but it was quicker to
edit the file than copy-and-paste the diff from the email body.

> Even more obvious than the literal compiler error message (which is all
> *I* got), *plus* a patch?


> > > -        if ( (unsigned int)Listener::getBaseAddress() == 0x0 )
> > > +        if ( Listener::getBaseAddress() == 0x0 )

I was trying to avoid offending you again, and it wasn't clear exactly
what the patch was. This diff was already in trunk (maybe the committer
had already applied it). Pointers should checked by comparing to 0, NULL
or (usually best) using the ! operator. Other integral expressions that
evaluate to 0 are allowed - so the patch is legitimate - but
unnecessarily complicated.

bwy

--
Use Gnash, the GNU Flash Player!
http://www.gnu.org/software/gnash/

Benjamin Wolsey, Software Developer - http://benjaminwolsey.de

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]