diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-11-10 12:31:38 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-11-10 12:32:54 -0800 |
commit | f197c2c9e5e0d12c373f26d5b3211809457bc972 (patch) | |
tree | 387fcc11de69afd85abe761c90d839c26187e0a0 /doc | |
parent | a66a3b96c5fdd092745f52f645c0bb843d14836e (diff) | |
download | gnulib-f197c2c9e5e0d12c373f26d5b3211809457bc972.tar.gz |
intprops: new public macro EXPR_SIGNED
Emacs can use this macro, so make it public.
* doc/intprops.texi (Arithmetic Type Properties): Rename from
'Integer Type Determination', since some of these macros apply
to non-integer types. Clarify what kinds of constant expressions
these macros return. Say when the arguments can be non-integers.
Mention newly published macro EXPR_SIGNED.
* lib/intprops.h (EXPR_SIGNED): Rename from _GL_INT_SIGNED, to
make it public. All uses changed.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/intprops.texi | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/doc/intprops.texi b/doc/intprops.texi index 55e60e99a6..732010c951 100644 --- a/doc/intprops.texi +++ b/doc/intprops.texi @@ -43,37 +43,52 @@ is easier to use, while the second, for integer ranges, has a simple and straightforward portable implementation. @menu -* Integer Type Determination:: Whether a type has integer properties. +* Arithmetic Type Properties:: Determining properties of arithmetic types. * Integer Bounds:: Bounds on integer values and representations. * Wraparound Arithmetic:: Well-defined behavior on signed overflow. * Integer Type Overflow:: General integer overflow checking. * Integer Range Overflow:: Integer overflow checking if bounds are known. @end menu -@node Integer Type Determination -@subsection Integer Type Determination +@node Arithmetic Type Properties +@subsection Arithmetic Type Properties @findex TYPE_IS_INTEGER -@code{TYPE_IS_INTEGER (@var{t})} is a constant +@code{TYPE_IS_INTEGER (@var{t})} is an arithmetic constant expression that is 1 if the arithmetic type @var{t} is an integer type. @code{_Bool} counts as an integer type. @findex TYPE_SIGNED -@code{TYPE_SIGNED (@var{t})} is a constant expression -that is 1 if the arithmetic type @var{t} is a signed integer type or a +@code{TYPE_SIGNED (@var{t})} is an arithmetic constant expression +that is 1 if the real type @var{t} is a signed integer type or a floating type. If @var{t} is an integer type, @code{TYPE_SIGNED (@var{t})} is an integer constant expression. +@findex EXPR_SIGNED +@code{EXPR_SIGNED (@var{e})} is 1 if the real expression @var{e} +has a signed integer type or a floating type. If @var{e} is an +integer constant expression or an arithmetic constant expression, +@code{EXPR_SIGNED (@var{e})} is likewise. Although @var{e} is +evaluated, if @var{e} is free of side effects then @code{EXPR_SIGNED +(@var{e})} is typically optimized to a constant. + Example usage: @example #include <intprops.h> #include <time.h> + enum @{ time_t_is_signed_integer = TYPE_IS_INTEGER (time_t) && TYPE_SIGNED (time_t) @}; + +int +CLOCKS_PER_SEC_is_signed (void) +@{ + return EXPR_SIGNED (CLOCKS_PER_SEC); +@} @end example @node Integer Bounds |