2 ms·
Okey... Now I cant understand only one thing: how do you jump in conclusions to your last sentence? If you use asm and try to pass array into function, then you
by ordu 10y ago
Okey... Now I cant understand only one thing: how do you jump in conclusions to your last sentence? If you use asm and try to pass array into function, then you will pass address of array, not a copy of array on stack. Looks similar to C behaviour, isn't it?
- gpderetta 10y agoWhether you copy or pass by reference has everything to do with the language semantcis, ABI and calling convention and nothing to do with asm. For example, if you look at the generated asm, C on amd64 will happily pass a struct by copy in registers, but will pass an array by address. The designers of C decided to give arrays pass by reference semantics and struct pass by value [1]; this was done because is convenient: you often want to iterate through arrays and pointers are the most generic way, but it does make arrays not first class. [1] admittedly traditional C couldn't pass structs at all.