unsigned ints and overflow

unsigned ints and overflow

am 05.03.2006 12:40:26 von fritz-bayer

Hi,

is there any way how I can use unsigned integers for a variable in
perl?

Fritz

Re: unsigned ints and overflow

am 05.03.2006 13:13:13 von Slaven Rezic

fritz-bayer@web.de writes:

> Hi,
>
> is there any way how I can use unsigned integers for a variable in
> perl?

Perl-intern passiert das automatisch, wenn ein Wert für einen signed
int zu groß wäre:

perl5.8.8 -MDevel::Peek -e '$x=2**31-1; Dump $x; $x++; Dump $x'
SV = IV(0x813b8d0) at 0x811dda8
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 2147483647
SV = IV(0x813b8d0) at 0x811dda8
REFCNT = 1
FLAGS = (IOK,pIOK,IsUV)
UV = 2147483648

Ein IV ist ein signed int, ein UV (zusammen mit dem Flag IsUV) zeigt
ein unsigned int an.

Gruß,
Slaven

--
Slaven Rezic - slaven rezic de

tktimex - time recording tool
http://sourceforge.net/projects/ptktools/