unsigned ints and overflow

Hi,

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

Fritz
fritz-bayer [ So, 05 März 2006 12:40 ] [ ID #1215776 ]

Re: unsigned ints and overflow

fritz-bayer [at] 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 <at> rezic <dot> de

tktimex - time recording tool
http://sourceforge.net/projects/ptktools/
Slaven Rezic [ So, 05 März 2006 13:13 ] [ ID #1215778 ]
Perl » de.comp.lang.perl.misc » unsigned ints and overflow

Vorheriges Thema: Datenaustausch zw. 2 Scripten
Nächstes Thema: Installationsmethode fürScriptsammlung