6 ms·
I cannot for my life remember the argument order, so I write the manual code and let IntelliJ convert it.
by gdprrrr 3y ago
I cannot for my life remember the argument order, so I write the manual code and let IntelliJ convert it.
- josefx 3y agoDoesn't autocomplete show the arguments? I usually use Netbeans when I write Java, so no idea if InelliJ is just that bad.
- nayuki 3y agoIn 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.
- thwarted 3y agomemcpy 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.
- tom_ 3y agoBritish people generally don't, but Americans very often use "to...from".
- nisse72 3y agoThey 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.