Lugaru's Epsilon Programmer's Editor
Context:

Previous

Up

Next

Unary Operators 
Epsilon Extension Language 
Assignment Operators 
Epsilon User's Manual and Reference >
Epsilon Extension Language >
Expressions >
Simple Binary Operators
expression:
expression + expression
expression  expression
expression * expression
expression / expression
expression % expression
expression == expression
expression != expression
expression < expression
expression > expression
expression <= expression
expression >= expression
expression && expression
expression  expression
expression & expression
expression  expression
expression ^ expression
expression << expression
expression >> expression
The binary + operator, when applied to numbers, yields the sum of
the numbers. One of its operands may also be a pointer to an object in
an array. In this case, the result is a pointer to the same array,
offset by the number to another object in the array. For example, if
p points to an object in an array, p + 1 points to the next
object in the array and p  1 points to the previous object,
regardless of the object's type.
The binary  operator, when applied to numbers, yields the
difference of the numbers. If the first operand is a pointer and the
second is a number, the rules for addition of pointers and numbers
apply. For example, if p is a pointer, p  3 is the same
as p + 3 .
Both operands may also be pointers to objects in the same array. In
this case the result is the difference between them, measured in
objects. For example, if arr is an array of ten ints, p1
points to the third int, and p2 points to the eighth, then
p1  p2 yields the int 5. The result is undefined if the
operands are pointers to different arrays.
The binary * operator is for multiplication, and the /
operator is for division. The latter truncates toward 0 if its
operands are positive, but the direction of truncation is undefined
if either operand is negative. The % operator provides the
remainder of the division of its operands, and x % y is always
equal to x  (x / y) * y . All three operators take only numbers
and yield ints.
The == operator yields one if its arguments are equal and zero
otherwise. The arguments must either both be numbers, both spots, or
both pointers to objects of the same type. However, if one argument
is the constant zero, the other may be a spot or any type of pointer,
and the expression yields one if the pointer is null, and zero otherwise.
The != operator is just like the == operator, but returns one
where == would return zero, and zero where == would return
one. The result of either operator is always an int.
The < , > , <= , and >= operators have a value of one
when the first operand is less than, greater than, less than or equal
to, or greater than or equal to (respectively) the second operand.
The operands may both be numbers, they may be pointers to the same
array, or one may be a pointer or spot and the other zero. In the
last case, Epsilon returns values based on the convention that a
null pointer or spot is equal to zero and a nonnull one is greater
than zero. The result is undefined if the operands are pointers to
different arrays of the same type, and it is an error if they are
pointers to different types of objects, or if one is a spot and the
other is neither a spot nor zero.
The && operator yields one if both operands are nonzero, and
zero otherwise. Each operand may be a pointer, spot, or number.
Moreover, the first operand is evaluated first, and if it is zero,
the second operand will not be evaluated. The result is an int.
The  operator yields one if either of its operands are nonzero,
and zero if both are zero. Each operand may be a pointer, spot, or
number. The first operand is evaluated first, and if it is nonzero,
the second operand will not be evaluated. The result is an int.
The & operator yields the bitwise AND of its numeric operands.
The  and ^ operators yields the bitwise OR and XOR
(respectively) of their numeric operands. The result for all three
is an int. A bit in the result of an AND is on if both
corresponding bits in its operands are on. A bit in the result of an
OR is on if either of the corresponding bits in its operands are on.
A bit in the result of an XOR is on if one of the corresponding bits
in its operands is on and the other is off.
The << operator yields the first operand with its bits shifted to
the left the number of times given by the right operand. The
>> operator works similarly, but shifts to the right. The former
fills with zero bits, and the latter fills with one bits if the first
operand was negative, and zero bits otherwise. If the second operand
is negative or greater than 31, the result is undefined. Both
operands must be numbers, and the result is an int.
Previous

Up

Next

Unary Operators 
Epsilon Extension Language 
Assignment Operators 
Copyright (C) 1984, 2018 Lugaru Software Ltd. All Rights Reserved.
