|
|||||||||||
Technical Support Support Resources
Product Information |
C51: Why Does VA_ARGS Work?Information in this article applies to:
QUESTIONI am planning on using the va_args macros in my code, however, the C-compiler likes to pass up to 5 parameters in registers. This would seem to break the va_args macro! Since the va_list macro needs to get the address of an argument, if the argument is in a register there is a problem (because we cannot take the address of a register). How does one handle this situation? ANSWERArguments in the variable-length portion of the argument list are never placed in registers, so the problems you anticipate don't occur. For example, consider the following program:
The code generated for the print_strings function call appears as follows:
Note that the arguments that are part of the variable length list are not placed in registers. MORE INFORMATIONLast Reviewed: Thursday, February 25, 2021 | ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.