This question is answerable for C++: Stroustrup, "Design and Evolution of C++" discusses this in section 11.6.1, pp. 247-250.
There were general objections to adding a new operator. It would add to the already overcomplicated precedence table. The members of the working group thought it would give only minor convenience over having a function, and they wanted to be able to substitute their own functions sometimes.
There was no good candidate for an operator. ^
is exclusive-or, and ^^
invited confusion because of the relationship between &
and |
and &&
and ||
. !
was unsuitable since there would be the natural tendency to write !=
for exponentiation of an existing value, and that was already taken. The best available may have been *^
, which apparently nobody really liked.
Stroustrup considered **
again, but it already has a meaning in C: a**p
is a
times whatever p
points to, and char ** c;
declares c
as a pointer to pointer to char
. Introducing **
as a token meaning "declaration of a pointer to pointer to", "times what the next thing points to" (if it's a pointer) or "exponentiation" (if followed by a number) caused precedence problems. a/b**p
would have to parse as a/(b**p)
if p were a number, but (a/b) * *p
if p were a pointer, so this would have to be resolved in the parser.
In other words, it would have been possible, but it would have complicated the precedence table and the parser, and both are already too complicated.
I don't know the story about Java; all I could do would be speculate. As for C, where it started, all C operators are easily translated into assembly code, partly to simplify the compiler and partly to avoid hiding time-consuming functionality in simple operators (the fact that operator+()
and others could hide great complexity and performance hits was one of the early complaints about C++).
^
operator do not match the precedence of exponentiation. Consider the expressiona + b ^ c
. In mathematics, the exponentiation is performed first (b ^ c
), then the resulting power is added toa
. In C++, the addition is performed first (a + b
) then the^
operator is performed withc
. So even if you did implement the^
operator to mean exponentiation, the precedence will surprise everyone.^
is an XOR in C++. It is advised that overloaded operator should do no different what a primitive data type does using it.++
operator or the!
operator et. al. to mean exponentation. But you can't anyway, because the operators you talk about accept only one argument; exponentiation requires two arguments.