Jump to content

Operator (computer programming)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SeanProctor (talk | contribs) at 02:03, 27 July 2004 (initial page stolen from operator). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Programming languages have a set of operators that perform arithmetical operations, and others such as Boolean operations on truth values, and string operators manipulating strings of text. Computers are mathematical devices, but compilers and interpreters require a full syntactic theory of all operations in order to parse formulae involving any combinations correctly. In particular they depend on operator precedence rules, on order of operations, that are tacitly assumed in mathematical writing.

Conventionally, the computing usage of operator also goes beyond the mathematical usage (for functions). The C programming language syntax for pointers, uses the operators * and &. sizeof is sometimes considered an operator, and in C++, new and delete are also operators. In object oriented languages, such as C++, you can define your own uses for operators.

In certain programming languages, such as PostScript, the use of the word "operator" has more specific meaning, in that an operator is an executable element in the stack. Because operators here are always written postfix, the need for brackets is redundant as the way objects are taken from the stack ensures correct evaluation. This is an example of Reverse Polish notation.