(W) You may have tried to use an 8 or 9 in a octal number. Interpretation
of the octal number stopped before the 8 or 9.
-=item Illegal hex digit %s ignored
+=item Illegal hexadecimal digit %s ignored
(W) You may have tried to use a character other than 0 - 9 or A - F in a
hexadecimal number. Interpretation of the hexadecimal number stopped
=item Integer overflow in %s number
-(S) The literal hex, octal or binary number you have specified is
-too big for your architecture. On a 32-bit architecture the largest
+(S) The literal hexadecimal, octal or binary number you have specified
+is too big for your architecture. On a 32-bit architecture the largest
literal hex, octal or binary number representable without overflow
is 0xFFFFFFFF, 037777777777, or 0b11111111111111111111111111111111
respectively. Note that Perl transparently promotes decimal literals
no warning 'unsafe' ;
*a = hex "0xv9" ;
EXPECT
-Illegal hex digit 'v' ignored at - line 3.
+Illegal hexadecimal digit 'v' ignored at - line 3.
########
# util.c
use warning 'unsafe' ;
Illegal binary digit '9' ignored at - line 3.
########
# util.c
+BEGIN { require Config ; import Config }
$^W =1 ;
+sub make_bin { "1" x $_[0] }
+$n = make_bin(8 * $Config{longsize} ) ;
+$o = make_bin(8 * $Config{longsize} + 1) ;
{
use warning 'unsafe' ;
- my $a = oct "0b111111111111111111111111111111111" ;
+ my $a = oct "0b$n" ;
+ my $b = oct "0b$o" ;
no warning 'unsafe' ;
- $a = oct "0b111111111111111111111111111111111" ;
+ $b = oct "0b$o" ;
}
-my $a = oct "0b111111111111111111111111111111111" ;
+my $b = oct "0b$o" ;
EXPECT
-Integer overflow in binary number at - line 5.
-Integer overflow in binary number at - line 9.
+Integer overflow in binary number at - line 10.
+Integer overflow in binary number at - line 14.
########
# util.c
+BEGIN { require Config ; import Config }
$^W =1 ;
+sub make_oct { ("","1","3")[$_[0]%3] . "7" x int($_[0]/3) }
+$n = make_oct(8 * $Config{longsize} );
+$o = make_oct(8 * $Config{longsize} + 1);
{
use warning 'unsafe' ;
- my $a = oct "777777777777777777777777777777777777" ;
+ my $a = oct "$n" ;
+ my $b = oct "$o" ;
no warning 'unsafe' ;
- $a = oct "777777777777777777777777777777777777" ;
+ $b = oct "$o" ;
}
-my $a = oct "777777777777777777777777777777777777" ;
+my $b = oct "$o" ;
EXPECT
-Integer overflow in octal number at - line 5.
-Integer overflow in octal number at - line 9.
+Integer overflow in octal number at - line 10.
+Integer overflow in octal number at - line 14.
########
# util.c
+BEGIN { require Config ; import Config }
$^W =1 ;
+sub make_hex { ("","1","3","7")[$_[0]%4] . "f" x int($_[0]/4) }
+$n = make_hex(8 * $Config{longsize} ) ;
+$o = make_hex(8 * $Config{longsize} + 1) ;
{
use warning 'unsafe' ;
- my $a = hex "ffffffffffffffffffffffffffffffff" ;
+ my $a = hex "$n" ;
+ my $b = hex "$o" ;
no warning 'unsafe' ;
- $a = hex "ffffffffffffffffffffffffffffffff" ;
+ $b = hex "$o" ;
}
-my $a = hex "ffffffffffffffffffffffffffffffff" ;
+my $b = hex "$o" ;
EXPECT
-Integer overflow in hex number at - line 5.
-Integer overflow in hex number at - line 9.
+Integer overflow in hexadecimal number at - line 10.
+Integer overflow in hexadecimal number at - line 14.
dTHR;
--s;
if (ckWARN(WARN_UNSAFE))
- Perl_warner(aTHX_ WARN_UNSAFE,"Illegal hex digit '%c' ignored", *s);
+ Perl_warner(aTHX_ WARN_UNSAFE,"Illegal hexadecimal digit '%c' ignored", *s);
break;
}
}
if (!overflowed && (n >> 4) != retval) {
dTHR;
if (ckWARN_d(WARN_UNSAFE))
- Perl_warner(aTHX_ WARN_UNSAFE, "Integer overflow in hex number");
+ Perl_warner(aTHX_ WARN_UNSAFE, "Integer overflow in hexadecimal number");
overflowed = TRUE;
}
retval = n | ((tmp - PL_hexdigit) & 15);