📄 express.gml
字号:
.kw unsigned int
..ct ..li .
All the usual integer conversion rules then apply.
.*
.shade end
..do end
.*
.************************************************************************
.*
.keep begin
.section Multiplicative Operators
.*
.cillust begin
multiplicative-expression:
.cbr
&SYSRB.&SYSRB.&SYSRB.&SYSRB.cast-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.multiplicative-expression
.mono *
cast-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.multiplicative-expression
.mono /
cast-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.multiplicative-expression
.mono %
cast-expression
.cillust end
.keep end
.pp
The
.mono *
symbol, in its binary form, yields the
.ix 'product'
.ix 'operator' 'product'
.ix 'operator' 'times'
.ix 'operator' 'binary *'
.us product
of its operands.
The operands must have arithmetic type,
and have the usual arithmetic conversions performed on them.
.* .pp
.* The product operator is both commutative and associative, so the
.* compiler, in the absence of the unary
.* .ix 'unary operator' '+'
.* + operator, may regroup a series of multiplications.
.pp
The
.mono /
symbol yields the
.ix 'quotient'
.ix 'operator' 'quotient'
.ix 'operator' 'division'
.ix 'operator' '/'
.us quotient
from the division of the first operand
by the second operand.
The operands must have arithmetic type,
and have the usual arithmetic conversions performed on them.
Note that when a division by zero occurs, the behavior is
undefined.
.pp
When both operands of / are
of integer type and positive value,
and the division is inexact,
the result is the
.ix 'rounding'
.ix truncation
.ix 'division' 'rounding'
.ix integer division rounding
largest integer less than the algebraic (exact)
quotient. (The result is rounded down.)
.pp
When one or both operands of / is negative and the division is inexact,
whether the compiler rounds the value up or down is
implementation-defined.
.*
.************************************************************************
.*
.shade begin
..if '&target' eq 'PC' ..th ..do begin
The &wcboth. compilers always round
..do end
..el ..if '&target' eq 'PC 370' ..th ..do begin
The &wcall. compilers always round
..do end
.ix integer division rounding
.ix division rounding
the result of integer division
toward zero.
This action is also called
.ix integer division truncation
.ix division truncation
truncation.
.shade end
.*
.************************************************************************
.*
.pp
The
.mono %
symbol yields the
.ix 'remainder'
.ix 'modulus'
.ix 'operator' 'remainder'
.ix 'operator' 'modulus'
.ix 'operator' '%'
.us remainder
from the division of the first operand
by the second operand.
The operands of
.mono %
must have integral type.
.pp
When both operands of
.mono %
are positive, the result is
a positive value smaller than the second operand. When one or both
operands is negative, whether the result is positive or negative
is implementation-defined.
.*
.************************************************************************
.*
..if '&target' eq 'PC' ..th ..do begin
.shade begin
With the &wcboth. compiler,
the remainder has the same sign as the first operand.
.shade end
..do end
..if '&target' eq 'PC 370' ..th ..do begin
.shade begin
With the &wcall. compilers,
the remainder has the same sign as the first operand.
.shade end
..do end
.*
.************************************************************************
.*
.pp
For integral types
.mono a
and
.mono b
..ct ,
if
.mono b
is not zero, then
.monoon
(a/b)*b&SYSRB.+&SYSRB.a%b
.monooff
will equal
.mono a
..ct ..li .
.*
.keep begin
.section Additive Operators
.*
.uillust begin
additive-expression:
&SYSRB.&SYSRB.&SYSRB.&SYSRB.multiplicative-expression
.uor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.additive-expression :MONO.+:eMONO. multiplicative-expression
.uor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.additive-expression :MONO.-:eMONO. multiplicative-expression
.uillust end
.keep end
.pp
The
.mono +
symbol, in its binary form,
denotes the
.ix 'addition'
.ix 'sum'
.ix 'operator' 'addition'
.ix 'operator' 'sum'
.ix 'operator' 'binary +'
.ix 'plus' 'binary'
.us sum
of its operands.
.pp
If both operands have arithmetic type, then the usual arithmetic
conversions are performed on them.
.pp
If one of the operands is a pointer, then the other operand must
have an integral type.
The pointer operand may not be a pointer to
.kw void
..ct ..li .
Before being added to the pointer value, the integral value is
multiplied by the size of the object to which the pointer points. The
result type is the same as the pointer operand type.
If the pointer value is a pointer to a member of an array, then the
resulting pointer will point to a member of the same array, provided
the array is large enough. If the resulting pointer does not point
to a member of the array, then its use with the unary
.mono *
(indirection)
or
.mono ->
(arrow)
operator will yield undefined
.* (and probably incorrect)
behavior.
.pp
The :MINUS. symbol, in its binary form,
denotes the
.ix 'subtraction'
.ix 'difference'
.ix 'operator' 'subtraction'
.ix 'operator' 'difference'
.ix 'operator' 'binary -'
.ix 'minus' 'binary'
.us difference
resulting from the subtraction of the second operand from the first.
If both operands have arithmetic type, then the usual arithmetic
conversions are performed on them.
.pp
If the first operand is a pointer, then the second operand must either
be a pointer to the same type or an integral type.
.pp
In the same manner as for adding a pointer and an integral value, the
integral value is multiplied by the size of the object to which the
pointer points.
The pointer operand may not be a pointer to
.kw void
..ct ..li .
The result type is the same type as the pointer operand.
.pp
If both operands are pointers to the same type, the difference is
divided by the size of the type, representing the difference of
the subscripts of the two array members (assuming the type is "array of
.us type
..ct ").
The type of the result is implementation-defined, and is represented
by
.ix ptrdiff_t
.kw ptrdiff_t
(a signed integral type)
defined in the
.hdr <stddef.h>
header.
.*
.************************************************************************
.*
..if '&target' eq 'PC' or '&target' eq 'PC 370' ..th ..do begin
.shade begin
With &wcboth.,
.ix ptrdiff_t
.kw ptrdiff_t
is
.kw int
..ct ,
unless the
.ix 'memory model' 'huge'
.ix 'huge memory model'
huge memory model is being used, in which case
.ix ptrdiff_t
.kw ptrdiff_t
is
.kw long int
..ct ..li .
.shade end
..do end
..if '&target' eq 'PC 370' ..th ..do begin
.shade begin
With &wlooc., the type of
.ix ptrdiff_t
.kw ptrdiff_t
is
.kw int
..ct ..li .
.shade end
..do end
.*
.************************************************************************
.*
.*
.* .keep begin
.section Bitwise Shift Operators
.*
.cillust begin
shift-expression:
.cbr
&SYSRB.&SYSRB.&SYSRB.&SYSRB.additive-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.shift-expression
.mono <<
additive-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.shift-expression
.mono >>
additive-expression
.cillust end
.* .keep end
.pp
The
.mono <<
symbol denotes the
.ix 'left shift'
.ix 'shift' 'left'
.ix 'operator' 'left shift'
.us left-shift
operator. Both operands must have an integral type, and the
integral promotions are performed on them.
The type of the result is the type of the promoted left operand.
.pp
The result of
.monoon
op&SYSRB.<<&SYSRB.amt
.monooff
is
.mono op
left-shifted
.mono amt
bit positions. Zero bits are filled on the right.
Effectively, the high bits shifted out of
.mono op
are discarded, and the resulting set of bits is re-interpreted as the
result.
Another interpretation is that
.mono op
is multiplied by 2 raised to the power
.mono amt
..ct ..li .
.pp
The
.mono >>
symbol denotes the
.ix 'right shift'
.ix 'shift' 'right'
.ix 'operator' 'right shift'
.us right-shift
operator. Both operands must have an integral type, and the
integral promotions are performed on them.
The type of the result is the type of the promoted left operand.
.pp
The result of
.monoon
op&SYSRB.>>&SYSRB.amt
.monooff
is
.mono op
right-shifted
.mono amt
bit positions.
If
.mono op
has an unsigned type, or a signed type and a non-negative value,
then
.mono op
is divided by 2 raised to the power
.mono amt
..ct ..li .
Effectively, the low bits shifted out of
.mono op
are discarded, zero bits are filled on the left,
and the resulting set of bits is re-interpreted as the
result.
.pp
If
.mono op
has a signed type and negative value, then the behavior of
.monoon
op&SYSRB.>>&SYSRB.amt
.monooff
is implementation-defined.
Usually, the high bits vacated by the right shift are filled with
the sign bit from before the shift (arithmetic right shift), or with
0 (logical right shift).
.*
.************************************************************************
.*
.shade begin
..if '&target' eq 'PC' ..th ..do begin
With &wcboth.,
..do end
..el ..if '&target' eq 'PC 370' ..th ..do begin
With &wcall.,
..do end
a right shift of a negative value of a signed type
causes the sign bit to be propogated throughout the
bits vacated by the shift.
Essentially, the vacated bits are filled with 1 bits.
.shade end
.*
.************************************************************************
.*
.pp
For both
bitwise shift operators, if the number of bits to shift exceeds the
number of bits in the type, the result is undefined.
.*
.keep begin
.section Relational Operators
.*
.cillust begin
relational-expression:
.cbr
&SYSRB.&SYSRB.&SYSRB.&SYSRB.shift-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.relational-expression
.mono <
shift-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.relational-expression
.mono >
shift-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.relational-expression
.mono <=
shift-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.relational-expression
.mono >=
shift-expression
.cillust end
.keep end
.pp
Each of the symbols
.ix 'less than'
.ix 'operator' 'less than'
.ix 'operator' '<'
.mono <
.us (less than),
.ix 'greater than'
.ix 'operator' 'greater than'
.ix 'operator' '>'
.mono >
.us (greater than),
.ix 'less than or equal to'
.ix 'not greater than'
.ix 'operator' 'less than or equal to'
.ix 'operator' 'not greater than'
.ix 'operator' '<='
.mono <=
.us (less than or equal to),
.ix 'greater than or equal to'
.ix 'not less than'
.ix 'operator' 'greater than or equal to'
.ix 'operator' 'not less than'
.ix 'operator' '>='
.mono >=
.us (greater than or equal to),
yields the value 1 if the relation is true, and 0 if the relation
is false. The result type is
.kw int
..ct ..li .
.pp
If both operands have arithmetic type, then the usual arithmetic
conversions are performed on them.
.pp
If one of the operands is a pointer, then the other operand must be
a pointer to a compatible type.
The result depends on where (in the address space of the computer)
the pointers actually point.
.pp
If both pointers point to
members of the same array object,
then the pointer that points
to the member with a higher subscript will be greater than the other
pointer.
.pp
If both pointers point to different members within the same structure,
then the pointer pointing to the member declared later in the structure
will be greater than the other pointer.
.pp
If both pointers point to the same union object, then they will be
equal.
.pp
All other comparisons yield undefined behavior. As discussed above,
the relationship between pointers is determined by the locations in
the machine storage that the pointers reference.
Typically, the numeric values of the pointer operands are compared.
.*
.keep begin
.section Equality Operators
.*
.cillust begin
equality-expression:
.cbr
&SYSRB.&SYSRB.&SYSRB.&SYSRB.relational-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.equality-expression
.mono ==
relational-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.equality-expression
.mono !=
relational-expression
.cillust end
.keep end
.pp
The symbols
.mono ==
.ix 'equal to'
.ix 'operator' 'equal to'
.ix 'operator' '=='
.us (equal to)
and
.mono !=
.ix 'not equal to'
.ix 'operator' 'not equal to'
.ix 'operator' '!='
.us (not equal to)
yield the value 1 if the relation is true, and 0 if the relation
is false. The result type is
.kw int
..ct ..li .
.pp
If both operands have arithmetic type, then the usual arithmetic
conversions are performed on them.
.pp
If both operands are pointers to the same type and they compare equal,
then they are pointers to the same object.
.pp
If both operands are pointers and one is a pointer to
.kw void
..ct ,
then the other is converted to a pointer to
.kw void
..ct ..li .
.pp
If one of the operands is a pointer, the other may be a null pointer
constant (zero).
.pp
No other combinations are valid.
.*
.* .keep begin
.section Bitwise AND Operator
.*
.cillust begin
and-expression:
.cbr
&SYSRB.&SYSRB.&SYSRB.&SYSRB.equality-expression
.cor
&SYSRB.&SYSRB.&SYSRB.&SYSRB.and-expression
.mono &
equality-expression
.cillust end
.* .keep end
.pp
The
.mono &
symbol, in its binary form, denotes the
.ix 'bitwise AND'
.ix 'operator' 'bitwise AND'
.ix 'operator' '&'
.ix 'operator' 'binary &'
.us bitwise AND
operator. Each of the operands must have integral type, and the
usual arithmetic conversions are performed.
.pp
The result is the bitwise AND of the two operands. That is, the bit
in the result is set if and only if each of the corresponding bits
in the operands are set.
.keep begin
.pp
The following table illustrates some
bitwise AND
operations:
..sk 1 c
.if &e'&nobox eq 0 .do begin
.boxdef
..if '&format' eq '7x9' ..th ..do begin
. .boxcol 14
. .boxcol 6
..do end
..el ..do begin
. .boxcol 16
. .boxcol 7
..do end
.boxbeg
汷peration 汻esult
.boxline
.monoon
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -