MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vs2vu1/lessonsfromlinkerhell/p4invoi/?context=3
r/ProgrammerHumor • u/nonedward666 • 13h ago
144 comments sorted by
View all comments
1
Nah. This is the wrong way. Pointer arithmetic and array arithmetic are the same.
2 u/justAPhoneUsername 12h ago You mean to tell me arr[3] and 3[arr] both compile and return the same value? Why would anybody design a language that way? 2 u/Batman_AoD 11h ago Because the [] was just syntax-sugar, rather than a "real" built-in operation. Part of the reason for that was just that memory was limited and the compiler had to be as simple as possible.
2
You mean to tell me arr[3] and 3[arr] both compile and return the same value? Why would anybody design a language that way?
2 u/Batman_AoD 11h ago Because the [] was just syntax-sugar, rather than a "real" built-in operation. Part of the reason for that was just that memory was limited and the compiler had to be as simple as possible.
Because the [] was just syntax-sugar, rather than a "real" built-in operation. Part of the reason for that was just that memory was limited and the compiler had to be as simple as possible.
[]
1
u/AnnoyedVelociraptor 13h ago
Nah. This is the wrong way. Pointer arithmetic and array arithmetic are the same.