News for hackers. Stuff that matters.
Re:C uses "&" for the address-operator because 'ampersand so... by flohofwoe on Tuesday October 10, 2023 @10:13AM (#37832373)
I really prefer that '.' and '->' remain separate, because it makes it immediately clear when a potentially expensive pointer derefence is happening:

    x = a->b->c->d->e;
...is a pointer-hunting-nightmare / potential cache-miss-galore.

    x = a.b.c.d.e;
...no problem, the whole chain is resolved at compile time into a single offset and results in at most one memory access.

    x = a.b.c->d.e;
...makes it immediately clear that c->d is a pointer access and everything else isn't.

PS: ...and of course C++ messed this simple rule up with the introduction of references.

Re:C uses "&" for the address-operator because 'ampersand so... by nuancebydefault on Tuesday October 10, 2023 @04:43PM (#37837223)
When stepping up from C to C++, it feels ultimately unlogical to use an ampersand to indicate a reference in a declaration, while in an assigment or actual parameter it means address of. Where they out of special chars?