Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C doesn't have double star either (in fact double star means double dereferencing).

YMMV or course, but distinction between a low-level language like C, and a higher-level one that can support exponentiation, matrix multiplication, thread spawning etc. as a first-class language construct is as clear to me as the difference between shell and non-shell.



Someone correct me if I'm wrong, but I believe double star as an infix operator would be interpreted as multiplication of a dereference:

  X ** Y
would be parsed as

  X * (*Y)


...but it's unlikely to be accidentally used as an exponent, since you can't dereference a number.


At least in that case the compiler should produce a warning about trying to deference the not-pointer.


C has an “exponentiation operator”, used in literals where you’d expect exponentiation in other languages: <<. (Sure, it’s limited to raising things to powers of 2, but when would you ever need to raise something to a non-power-of-2? :P)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: