Make note of new literal forms in docs.
This commit is contained in:
parent
0b9c882d66
commit
e08ed23a80
@ -756,6 +756,19 @@ and @emph{underscores}.
|
||||
|
||||
@end enumerate
|
||||
|
||||
By default, an integer literal is of type @code{int}. An integer literal may
|
||||
be followed (immediately, without any spaces) by a @dfn{integer suffix}, which
|
||||
changes the type of the literal. There are three kinds of integer literal
|
||||
suffix:
|
||||
|
||||
@enumerate
|
||||
@item The @code{u} suffix gives the literal type @code{uint}.
|
||||
@item The @code{g} suffix gives the literal type @code{big}.
|
||||
@item Each of the signed and unsigned machine types @code{u8}, @code{i8},
|
||||
@code{u16}, @code{i16}, @code{u32}, @code{i32}, @code{u64} and @code{i64}
|
||||
give the literal the corresponding machine type.
|
||||
@end enumerate
|
||||
|
||||
@sp 1
|
||||
A @dfn{floating-point literal} has one of two forms:
|
||||
@enumerate
|
||||
@ -765,6 +778,13 @@ second @emph{decimal literal}.
|
||||
@item A single @emph{decimal literal} followed by an @emph{exponent}.
|
||||
@end enumerate
|
||||
|
||||
By default, a floating-point literal is of type @code{float}. A floating-point
|
||||
literal may be followed (immediately, without any spaces) by a
|
||||
@dfn{floating-point suffix}, which changes the type of the literal. There are
|
||||
only two floating-point suffixes: @code{f32} and @code{f64}. Each of these
|
||||
gives the floating point literal the associated type, rather than
|
||||
@code{float}.
|
||||
|
||||
@sp 1
|
||||
A @dfn{hex digit} is either a @emph{decimal digit} or else a character in the
|
||||
ranges U+0061-U+0066 and U+0041-U+0046 (@code{'a'}-@code{'f'},
|
||||
@ -779,6 +799,28 @@ followed by a trailing @emph{decimal literal}.
|
||||
|
||||
A @dfn{sign character} is either U+002B or U+002D (@code{'+'} or @code{'-'}).
|
||||
|
||||
|
||||
Examples of integer literals of various forms:
|
||||
@example
|
||||
123; // type int
|
||||
123u; // type uint
|
||||
123_u; // type uint
|
||||
0xff00; // type int
|
||||
0xffu8; // type u8
|
||||
0b1111_1111_1001_0000_i32; // type i32
|
||||
0xffff_ffff_ffff_ffff_ffff_ffffg; // type big
|
||||
@end example
|
||||
|
||||
|
||||
Examples of floating-point literals of various forms:
|
||||
@example
|
||||
123.0; // type float
|
||||
0.1; // type float
|
||||
0.1f32; // type f32
|
||||
12E+99_f64; // type f64
|
||||
@end example
|
||||
|
||||
|
||||
@node Ref.Lex.Text
|
||||
@subsection Ref.Lex.Text
|
||||
@c * Ref.Lex.Key:: String and character tokens.
|
||||
@ -1314,8 +1356,8 @@ Other operations act on box values as single-word-sized address values,
|
||||
automatically adjusting reference counts on the associated heap
|
||||
allocation. For these operations, to access the value held in the box requires
|
||||
an explicit dereference of the box value. Explicitly dereferencing a box is
|
||||
indicated with the @emph{star} sigil @code{*}. Examples of such @dfn{explicit
|
||||
dererence} operations are:
|
||||
indicated with the unary @emph{star} operator @code{*}. Examples of such
|
||||
@dfn{explicit dererence} operations are:
|
||||
@itemize
|
||||
@item copying box values (@code{x = y})
|
||||
@item passing box values to functions (@code{f(x,y)})
|
||||
|
Loading…
x
Reference in New Issue
Block a user