2.4.2 Based Literals
Syntax
extended_digit ::= digit | A | B | C | D | E | F
Legality Rules
The
base (the numeric
value of the decimal
numeral
preceding the first #) shall be at least two and at most sixteen. The
extended_digits
A through F represent the digits ten through fifteen, respectively. The
value of each
extended_digit
of a
based_literal
shall be less than the base.
Static Semantics
The
extended_digits
A through F can be written either in lower case or in upper case, with
the same meaning.
Examples
Examples of based
literals:
2#1111_1111# 16#FF# 016#0ff# -- integer literals of value 255
16#E#E1 2#1110_0000# -- integer literals of value 224
16#F.FF#E+2 2#1.1111_1111_1110#E11 -- real literals of value 4095.0
Wording Changes from Ada 83
The rule about which letters are allowed is
now encoded in BNF, as suggested by Mike Woodger. This is clearly more
readable.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe