develooper Front page | perl.perl5.porters | Postings from June 2015

Re: Coverity finding: shift by negative

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
June 23, 2015 14:31
Subject:
Re: Coverity finding: shift by negative
Message ID:
20150623143114.GA24365@cancer.codesimply.com
* Zefram <zefram@fysh.org> [2015-06-23T09:59:09]
> Ricardo Signes wrote:
> >                        My tentative thinking is:
> >
> >  * right shifting by "a whole lot" gets you to zero
> >  * left shifting by a large enough value warns and keeps its current behavior
> 
> Why should these two be different?  Seems very strange to me to
> handle overlong shifts in two radically different ways depending on
> the direction.

I think they're being treated in the same way, insofar as that way is "leave it
mostly be."

Like I said, I'd rather treat them the same way: as repeated integer
doubling/halving, but unless we start promoting to big numbers, I don't think
the half measure we could take now would be worth it.

I think exposing the underlying representation would be a bit much.  Anyway,
"use integer" is meant to do that.

-- 
rjbs

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About