News for hackers. Stuff that matters.
Re:Why does the arrow (->) operator in C exist? by Tor3 on Friday May 22, 2026 @03:29AM (#48233055)
As was mentioned in one of the comments which actually described what the real cause was, it came from the original Ritchie C which had a syntax which in some cases differed a lot from what eventually became C. And in that version it did make sense to use a different operator. That reason disappeared when C as we know it came around, but the -> operator stayed. The real question is then why that wasn't reworked as well, when the underlying cause was.
Re:Why does the arrow (->) operator in C exist? by furyman on Friday May 22, 2026 @02:20AM (#48232625)
Majorly for reference. Reference to memory. I've seen mostly being used to carry pointer based operations. It make memory management efficient and also helpful in mindful and secure uses of memory.
Re:Why does the arrow (->) operator in C exist? by rurban on Friday May 22, 2026 @02:30AM (#48232679)
To denote that it is more costly than .
Re:Why does the arrow (->) operator in C exist? by glouwbug on Friday May 22, 2026 @10:29AM (#48236383)
Probably because (*p).field already worked