On Sunday 07 October 2007 15:31, Clinton Gormley wrote: > > -no warnings qw(uninitialized); > > +no warnings qw(uninitialized portable); > > This patch certaily removes the warnings, and all of the tests pass. But > does that mean that the module works correctly?
Yes, I think so. The point is 64bit integers are not portable to 32bit perls.
Hence, even on a 64bit system with warnings enabled a non-portable warning is
issued:
# perl -we 'print hex("100000002"),"\n",2**32+2,"\n"'
Hexadecimal number > 0xffffffff non-portable at -e line 1.
4294967298
4294967298
The same on a 32bit perl throws an additional overflow warning:
$ perl -we 'print hex("100000002"),"\n",2**32+2,"\n"'
Integer overflow in hexadecimal number at -e line 1.
Hexadecimal number > 0xffffffff non-portable at -e line 1.
4294967298
4294967298
Nevertheless the arithmetic is correct. 0xffffffff is 4294967295. Add 3 and
you get 4294967298.
Now try on a 64bit system the command again but turn warnings into errors:
# perl -e 'use warnings FATAL=>qw/all/; print
hex("100000002"),"\n",2**32+2,"\n"'
Hexadecimal number > 0xffffffff non-portable at -e line 1.
This is what happens on Max' system.
Now turn of the portable warning:
# perl -e 'use warnings FATAL=>qw/all/; no warnings "portable"; print
hex("100000002"),"\n",2**32+2,"\n"'
4294967298
4294967298
But on a 32bit perl we still get an error:
$ perl -e 'use warnings FATAL=>qw/all/; no warnings "portable"; print
hex("100000002"),"\n",2**32+2,"\n"'
Integer overflow in hexadecimal number at -e line 1.
Torsten
pgpy3cq5q1r6W.pgp
Description: PGP signature
