Hacker News new | ask | show | jobs
by gdprrrr 1025 days ago
I cannot for my life remember the argument order, so I write the manual code and let IntelliJ convert it.
2 comments

Doesn't autocomplete show the arguments? I usually use Netbeans when I write Java, so no idea if InelliJ is just that bad.
IntelliJ definitely shows the arguments lol
It shows the argument names and even highlights the current one where the cursor is. But sometimes my thought process is just different.
In Java, it's src array, src offset, dest array, dest offset, length. It's a natural order of from, to.

It's C memcpy() that's the odd one out by putting the destination before the source.

memcpy argument order matches the left-to-right arrangement of assignment. lhs=rhs is rhs is copied to lhs. memcpy(lhs,rhs) is the contents at rhs is copied to lhs.
British people generally don't, but Americans very often use "to...from".
They do, and it's jarring!

Even though I find memcpy and friends to be perfectly logical using the assignment analogy suggested by thwarted, I often need to re-read english sentences written that way.