Lugaru's Epsilon
Editor 14.04

Epsilon User's Manual and Reference
   Epsilon Extension Language
      . . .
      Order of Evaluation
         Constants and Identifiers
         Unary Operators
         Simple Binary Operators
         Assignment Operators
         . . .
      Constant Expressions
      . . .

Previous   Up    Next
Constants and Identifiers  Epsilon Extension Language   Simple Binary Operators

Epsilon User's Manual and Reference > Epsilon Extension Language > Expressions >

Unary Operators

        ! expression
        * expression
        & expression
        - expression
        ~ expression
        sizeof expression
        sizeof( type-name )
        ( type-name ) expression
        ++ expression
        -- expression
        expression ++
        expression --

The ! operator yields one if its operand is zero, and zero otherwise. It can be applied to pointers, spots, or numbers, but its result is always an int.

The unary * operator takes a pointer and yields the object it points to. If its operand has type "pointer to ...", the result has type "...", and is an lvalue. You can also apply * to an operand of type "spot", and the result is a number (a buffer position).

The unary & operator takes an lvalue and returns a pointer to it. It is the inverse of the * operator, and its result has type "pointer to ..." if its operand has type "...". (You cannot construct a spot by applying the & operator to a position. Use the alloc_spot( ) primitive described in Spots.)

The unary - and ~ operators work only on numbers. The first negates the given number, and the second flips all its bits, changing ones to zeros and zeros to ones.

The sizeof operator yields the size in bytes of an object. You can specify the object as an expression or with a type name (described in Type Names). In the latter case, sizeof returns the size in bytes of an object of that type. Characters and shorts require two bytes, and ints four bytes. An array of 10 ints requires 40 bytes, and this is the number sizeof(int [10]) will give, not 10.

An expression with a parenthesized type name before it is a cast. The cast converts the expression to the named type using the rules in Conversions, and the result is of that type. Specify the type using a type name, described in Type Names.

The ++ and -- operators increment and decrement their lvalue operands. If the operator appears before its operand, the value of the expression is the new value of the operand. The expression (++var) is the same as (var += 1), and (--var) is the same as (var -= 1). You can apply these operators to pointers, in which case they work as described under pointer addition below.

If the ++ or -- operators appear after their operand, the operand is changed in the same way, but the value of the expression is the value of the operand before the change. Thus the expression var++ has the same value as var, but var has a different value when you reference it the next time.

Previous   Up    Next
Constants and Identifiers  Epsilon Extension Language   Simple Binary Operators

Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.