[cxx-abi-dev] Passing non-trivial types through ...
Dennis Handly
dhandly at cup.hp.com
Wed Aug 13 21:38:45 UTC 2014
>From: "Nelson, Clark" <clark.nelson at intel.com>
>> since GCC 3.2, but a customer recently asked us to allow it, and it
>> occurs to me that the obvious way around the problems with bitwise
>> copying is to implement this as pass-by-invisible-reference, just like
>> normal value argument passing. Any objections?
Did the customer say how he was going to accept it on the callee side?
If by invisible-reference, the user must cheat and treat as a pointer,
then create the reference.
So, if you want reference, the user can instead pass as a pointer.
aCC6 allows it with a warning but the results are unpredictable:
warning #3290-D: Passing a non-POD object to a function with variable
arguments has undefined behavior. Object will be copied onto
the stack instead of using a constructor.
(This is a bitwise copy.)
This warning can be made an error by the user.
>The obvious next question is, exactly how would the implementation of
>va_arg work for non-trivial types? Would new magic be required? Or
>would the already-existing flavors of magic be enough?
Clark
I assume there is "magic" that assumes it is a POD?
More information about the cxx-abi-dev
mailing list