Re:C uses "&" for the address-operator because 'ampersand so...
by teo_zero on Wednesday October 11, 2023 @01:19AM
(#37841173)
> sadly * conflicts with infix multiplication.
I don't think it does. There's no ambiguity in parsing any expression that uses it in both se se.
It does conflict with division, though, because /* starts a comment!
BCPL has infix ! as well as prefix ! so you write an array index expression like array!index instead of array[index]. Infix ! is commutative like addition and [] in C.
You declare structures in BCPL by defining a constant for the offset of each member, so you can write object!MEMBER somewhat like C object->member. The semantics of -> in early C were very similar to BCPL infix ! except that members had types as well as offsets, but like BCPL there was nothing to tie a particular member to a particular structure as there is in modern C.
There’s a certain elegance to BCPL’s syntax that you don’t get from prefix-only or postfix-only indirection operators. C might have been better if it had stuck closer to BCPL in this respect, but sadly * conflicts with infix multiplication.
Some readers might also have used BCPL-style syntax for WIMP programming in BBC BASIC on RISC OS.