-
Notifications
You must be signed in to change notification settings - Fork 575
+= and ++ do different things under 'use integer' #3564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From dhd@eradicator.orgdhd@timebomb:~$ perl -v Looks to me like the pre/postincrement operators are not respecting Perl Info
|
From @iabynstill present in bleedperl@19435. The pre/post ++ ops upgrade to an NV; the += keeps the IV and wraps to zero. |
From cmoore@hellyeah.orgThe released 5.8.1 has this as well. |
From @smpeters
Comment from davem
Comment from hydo
I've tried this in later Perls, but it seems to be working correctly in |
From perl_dummy@bloodgate.comMoin, Steve wrote:
Nope, present in at least v5.8.3 (or re-introduced?): te@linux:~> perl -le 'use integer; $foo=0xffffffff; print $foo; ++$foo; This is perl, v5.8.3 built for i586-linux-thread-multi Copyright 1987-2003, Larry Wall Perl may be copied only under the terms of either the Artistic License or Complete documentation for Perl, including FAQ lists, should be found on Best wishes, Tels -- "Call me Justin, Justin Case." |
From @iabynOn Sat, Aug 28, 2004 at 06:12:07PM +0200, Tels wrote:
The real problem is that although there are integer-specific versions of #define Perl_pp_i_preinc Perl_pp_preinc So if we are agreed that $foo=0xffffffff; $foo++ should leave $foo Dave. -- |
From @nwc10On Wed, Sep 01, 2004 at 10:41:26PM +0100, Dave Mitchell wrote:
I have no opinion (yet) on the first part. But on the way to go, yes. This doesn't feel like the sort of change suitable for maint now. Nicholas Clark |
From @ysthOn Wed, Sep 01, 2004 at 10:41:26PM +0100, Dave Mitchell <davem@iabyn.com> wrote:
And with such an op and 32-bit ints, $foo=0x7fffffff; $foo++ should |
From @iabynOn Wed, Sep 01, 2004 at 02:58:24PM -0700, Yitzchak Scott-Thoennes wrote:
Yep. Note that currently: [davem@percy perl] P4$ perl585 -le'use integer;print 0x7fffffff+1' so we'd just be bringing ++ in line with +. But like you say, Dave. -- |
From @hvdsDave Mitchell <davem@iabyn.com> wrote: Hmm, what determines that it's an IV rather than a UV? Or is 'integer' (FWIW, almost all the stuff I do with 'use integer' wants unsigned Hugo |
From @ysthOn Thu, Sep 02, 2004 at 09:13:43AM +0100, hv@crypt.org wrote:
use integer means a C-level (IV) cast on arithmetic operands, so |
From @nwc10On Thu, Sep 02, 2004 at 01:45:34AM -0700, Yitzchak Scott-Thoennes wrote:
Mmm. So strictly that would mean that the result of 0x7fffffff + 1 under use Overflow of signed integer arithmetic is undefined behaviour in ANSI C, and Nicholas Clark |
From @iabynOn Thu, Sep 02, 2004 at 11:14:17AM +0100, Nicholas Clark wrote:
Gack! -- |
From @gannett-ggreerOn Tue Mar 13 00:39:47 2001, dhd@eradicator.org wrote:
The consensus of this ticket was "not during maint" but that is years DaveM also noted: so it is already inconsistent. One "solution" to the problem is everybody getting 64-bit machines: $ ./perl -I lib -le 'use integer; $foo=0xffffffff; print $foo; $foo += This ticket also notable for having Nicholas Clark's nasal demons. -- |
From @jkeenanOn Tue Mar 13 00:39:47 2001, dhd@eradicator.org wrote:
In Perl 5.14.2, 'perldoc integer' includes many qualifications about the ##### Given this documentation, should we keep this ticket open? Thank you very much. |
From @ikegamiOn Thu, Jan 5, 2012 at 8:56 PM, James E Keenan via RT <
Why do people use C<use integer;>? The pragma indicates it's for performance reasons (i.e. use the machine's Some might use the pragma to perform rounding (i.e. to get integers in the If anything, C<+= 1> is the one that needs fixing (i.e. switch to floating - Eric |
From @rjbsNo, I'm resolving this. It would be nice to see it fixed, but it's already documented and keeping |
From [Unknown Contact. See original ticket]No, I'm resolving this. It would be nice to see it fixed, but it's already documented and keeping |
@rjbs - Status changed from 'open' to 'resolved' |
From @rjbsI changed my mind. We need a policy for bugs that are listed as todos, rather than |
From [Unknown Contact. See original ticket]I changed my mind. We need a policy for bugs that are listed as todos, rather than |
@rjbs - Status changed from 'resolved' to 'stalled' |
From @jkeenanOn Sun Jan 08 08:16:24 2012, rjbs wrote:
rjbs: How's that todo list lookin'? ;-) Perhaps this should be in the Open queue rather than Stalled? Thank you very much. |
The RT System itself - Status changed from 'stalled' to 'open' |
From @iabynOn Sun, Oct 07, 2012 at 08:22:33AM -0700, James E Keenan via RT wrote:
yeah, I think its a bug. -- |
Migrated from rt.perl.org#6021 (status was 'open')
Searchable as RT6021$
The text was updated successfully, but these errors were encountered: