On 2013-02-11 06:52:28 +0000, "deadalnix" <deadal...@gmail.com> said:

When a function accept a struct, the compiler is free to use that function, or an altered one taking a reference as parameter.

When designing the ABI, you can either create the copy on the caller's side, or the callee's side. If I'm understanding well, you want to have two versions of each function, one copying on the caller's side, one copying on the callee's side, and the caller's codegen would choose which one to use. Copying on the caller's side is better if you're passing rvalues (because the caller can just always skip the copying), while copying on the callee's side is better when you're passing lvalues, because the caller may decide to skip copying if it doesn't need a copy.

I'm not sure creating two versions of each function will fly well with Walter. Actually, you say *two* are needed, but that's for a function with one struct parameter; it's more 2^(number of structs parameters) versions you'd need in the general case.


--
Michel Fortin
michel.for...@michelf.ca
http://michelf.ca/

Reply via email to