[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to m4/doc/m4.texinfo,v [branch-1_4]
From: |
Eric Blake |
Subject: |
Changes to m4/doc/m4.texinfo,v [branch-1_4] |
Date: |
Tue, 27 Jun 2006 13:31:47 +0000 |
CVSROOT: /sources/m4
Module name: m4
Branch: branch-1_4
Changes by: Eric Blake <ericb> 06/06/27 13:31:44
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.25
retrieving revision 1.1.1.1.2.26
diff -u -b -r1.1.1.1.2.25 -r1.1.1.1.2.26
--- doc/m4.texinfo 27 Jun 2006 12:49:52 -0000 1.1.1.1.2.25
+++ doc/m4.texinfo 27 Jun 2006 13:31:44 -0000 1.1.1.1.2.26
@@ -3064,8 +3064,8 @@
decreasing precedence.
@table @code
address@hidden -
-Unary minus
address@hidden + -
+Unary plus and minus
@item **
Exponentiation
@item * / %
@@ -3094,10 +3094,14 @@
All operators, except exponentiation, are left associative.
-Note that many @code{m4} implementations use @samp{^} as an alternate
-operator for the exponentiation, while many others use @samp{^} for the
-bitwise exclusive-or. GNU @code{m4} changed its behavior: it used to
-exponentiate for @samp{^}, it now computes the bitwise exclusive-or.
+Note that some older @code{m4} implementations use @samp{^} as an
+alternate operator for exponentiation, although @acronym{POSIX} requires
+the C behavior of bitwise exclusive-or. On the other hand, the
+precedence of @samp{~} and @samp{!} are different in GNU @code{m4} than
+they are in C, matching the precedence in traditional @code{m4}
+implementations. This behavior is likely to change in a future
+version to match @acronym{POSIX}, so use parentheses to force the
+desired precedence.
Numbers without special prefix are given decimal. A simple @samp{0}
prefix introduces an octal number. @samp{0x} introduces a hexadecimal
@@ -3140,6 +3144,24 @@
expression). Therefore all macros must be expanded before they are
passed to @code{eval}.
+All evaluation is done with 32-bit signed integers, assuming
+2's-complement with wrap-around. The shift operators are defined in GNU
address@hidden by doing an implicit bit-wise and of the right-hand operand
+with 0x1f, and sign-extension with right shift.
+
address@hidden
+eval(0x80000000 / -1)
address@hidden
+eval(0x80000000 % -1)
address@hidden
+eval(0x7fffffff)
address@hidden
+incr(eval(0x7fffffff))
address@hidden
+eval(-4 >> 33)
address@hidden
address@hidden example
+
If @var{radix} is specified, it specifies the radix to be used in the
expansion. The default radix is 10. The result of @code{eval} is
always taken to be signed. The @var{width} argument specifies a minimum
@@ -3790,6 +3812,18 @@
@samp{len(}, and @file{b.m4} contains @samp{abc)}, @kbd{m4 a.m4 b.m4}
outputs @samp{3} with traditional @code{m4}, but gives an error message
that the end of file was encountered inside a macro with GNU @code{m4}.
+
address@hidden
address@hidden requires @code{eval} (@pxref{Eval}) to treat all
+operators with the same precedence as C. However, GNU @code{m4}
+currently follows the traditional precedence of other @code{m4}
+implementations, where bitwise and logical negation (@samp{~} and
address@hidden) have lower precedence than equality operators, rather than
+equal precedence with other unary operators. Use explicit parentheses
+to ensure proper precedence. As extensions to @acronym{POSIX}, GNU
address@hidden treats the shift operators @samp{<<} and @samp{>>} as
+well-defined on signed integers (even though they are not in C), and
+adds the exponentiation operator @samp{**}.
@end itemize
@node Other Incompatibilities, , Incompatibilities, Compatibility
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2006/06/15
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2006/06/18
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2006/06/22
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2006/06/22
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2006/06/23
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2006/06/27
- Changes to m4/doc/m4.texinfo,v [branch-1_4],
Eric Blake <=
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2006/06/29
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2006/06/30
- Changes to m4/doc/m4.texinfo,v [branch-1_4], Eric Blake, 2006/06/30