This is bad, because in UNIX/Linux the calling convention uses the following registers:When defining a function, parameter order is: inputs, then outputs.
Parameters to C/C++ functions are either input to the function, output from the function, or both. Input parameters are usually values or const references, while output and input/output parameters will be non-const pointers. When ordering function parameters, put all input-only parameters before any output parameters
- RDI, RSI, RDX, RCX, R8, and R9
- RCX, RDX, R8, R9
On Windows that would mean just MOVing parameters to RSI and RDI, but on other UNIX-like platforms it requires an extra temp register whereas if the recommendation was reversed, Windows should perform the same and other platforms could potentially shave 3 operations (both MOVs and the temp) off of every function that moves data.
Not to mention it would match the rest of the world:
void *memmove(void *dest, const void *src, size_t n);
void *memcpy(void *dest, const void *src, size_t n);
char *strcpy(char *dest, const char *src);
... and practically every other standard function
Further reading:
https://en.wikipedia.org/wiki/X86_calli ... _AMD64_ABI - shows differences in various calling conventions
https://google-styleguide.googlecode.co ... r_Ordering - google's C++ style guide
http://stackoverflow.com/a/4438515/1162141 - discusses reasons behind the calling convention
http://www.swansontec.com/sregisters.html - tells what function each register is designed for