| That's quite interesting. I see two possible implementations: - either the struct is replicated at the function call (not really efficient, but the semantics are straightforward); - either the struct is used to prepare directly the stack for the function call (more efficient, but the semantics must be defined). One of the issues of the second approach is that if the structure/variable is a classical one, what should happen if we use the variable after the call? If we have to read the values inserted before the call then we have to keep a copy of the structure in the stack (so it's the same as the first approach).
Or we can consider that the variable no longer exists in the scope.
Which corresponds to the ownership concept in Rust for example. (but, to my knowledge, this does not exist in C++) What is the best option? Or are there other options? Another question, what sizeof(foo::args) should return ? |
struct foo_args{char a; short b; long c; float d; etc...}
and then asked for sizeof(foo_args).