[m-rev.] for review: extend coverage of builtin types in the reference manual
Peter Wang
novalazy at gmail.com
Mon Sep 17 22:00:27 AEST 2018
On Mon, 17 Sep 2018 05:46:38 +0000 (UTC), Julien Fischer <jfischer at opturion.com> wrote:
>
> Extend coverage of builtin types in the reference manual.
>
> Replace the table of builtin types with separate subsections that cover
> the primitive and other builtin types.
>
> Add documentation for the fixed size integer types.
>
> Tighten up the specification of builtin types in various ways, namely:
>
> - require that int and uint are at least 32-bits in width.
> - require that int and uint be the same width.
> - require that float be either a 32- or 64-bit IEEE floating-point value.
> - specify that char corresponds to a Unicode code point.
> - restrict the allowed encoding for Mercury strings to be either UTF-8 or UTF-16.
>
> doc/reference_manual.texi:
> As above.
> + at node Signed integer types
> + at subsubsection Signed integer types
> +There are five primitive signed integer types: @code{int}, @code{int8},
> + at code{int16}, @code{int32} and @code{int64}.
> +
> +Except for @code{int}, the width of each of these is given by the numeric
> +suffix in its name.
> +
> +The width of @code{int} is implementation defined, but must be at least 32-bits
> +and must be equal to the width of the type @code{uint}.
> +
> +All signed integer types use two's-complement representation.
> +
> +Values of the type @code{int8} must be in the range @math{-128} to @math{127},
> +inclusive.
> +
> +Values of the type @code{int16} must be in the range @math{-32768} to @math{32767},
> +inclusive.
> +
> +Values of the type @code{int32} must be in the range @math{-2147483648} to
> + at math{2147483647}, inclusive.
> +
> +Values of the type @code{int64} must be in the range @math{-9223372036854775808}
> +to @math{9223372036854775807}, inclusive.
> +
> +Values of the type @code{int} must be in the range to @math{-(2^{N - 1})} to
> + at math{2^{N - 1} - 1}, inclusive; @math{N} being the width of @code{int}.
> +
in bits
> + at node Unsigned integer types
> + at subsubsection Unsigned integer types
> +There are five primitive unsigned integer types: @code{uint}, @code{uint8},
> + at code{uint16}, @code{uint32} and @code{uint64}.
> +
> +Except for @code{uint}, the width of each of these types is given by the numeric
> +suffix in its name.
> +
> +The width of @code{uint} is implementation defined, but must be at least
> +32-bits and must be equal to the width of the type @code{int}.
> +
> +Values of the type @code{uint8} must be in the range @math{0} to @math{255},
> +inclusive.
> +
> +Values of the type @code{uint16} must be in the range @math{0} to @math{65535},
> +inclusive.
> +
> +Values of the type @code{uint32} must be in the range @math{0} to
> + at math{4294967295}, inclusive.
> +
> +Values of the type @code{uint64} must be in the range @math{0} to
> + at math{18446744073709551615}.
> +
inclusive
> +Values of the type @math{uint} must be in the range @math{0} to
> + at math{2^N - 1}, inclusive; @math{N} being the width of @code{uint}.
> +
in bits
It looks fine to me.
Peter
More information about the reviews
mailing list