| |||||||||
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 some object oriented languages, such as C++, you can define your own uses for operators. When an operator is alphanumeric rather than a punctuation character, it is sometimes called a named operator.
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.
In some programming languages, an operator may work with more than one kind of datatype, (such as when the + operator is used for both addition of numbers and for the concatenation of strings). Such an operator is said to be overloaded. Some languages also allow for one or more operands of an operator to be coerced to another datatype, to permit an operation to occur, an example being when a numerical zero is added to a string, ie: 0 + "3.14159", the text "3.14159" has been coerced to a number.