glen herrmannsfeldt <(E-Mail Removed)> writes:

> Robert Miles <(E-Mail Removed)> wrote:

>> On Friday, February 1, 2013 6:16:46 PM UTC-6, Shao Miller wrote:

>>> On 2/1/2013 19:00, glen herrmannsfeldt wrote:

>>> > How about sizeof(2**x) vs. (sizeof 2 * * x)?
The unary sizeof operator binds more tightly than multiplication, so

the first yields the size of `2 * *x`, and the second is equivalent

to `(sizeof 2) * (*x)`.

It's not usually necessary to use parentheses with sizeof applied to an

expression, but as with any other operator you sometimes need

parentheses to deal with precedence.

>>> I'm so conditioned to C that I don't see the difference, but I can

>>> imagine some language that has '**' as an exponent operator...?

>

>> Fortran does. I haven't checked if there are any more.

>

> PL/I inherited it from Fortran, gawk (GNU awk) has it in

> addition to the ^ operator.

>

> Now, why doesn't C have one?
x**y and x^y are already well-defined expressions in C

(multiplication by a dereference and exclusive-or, respectively).

I suppose ^^ could have been used (since you can't have a

short-circuit xor). But the systems programming domain for which

C was originally designed didn't have much use for exponentiation.

--

Keith Thompson (The_Other_Keith)

http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>

Working, but not speaking, for JetHead Development, Inc.

"We must do something. This is something. Therefore, we must do this."

-- Antony Jay and Jonathan Lynn, "Yes Minister"