|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: Limits on Functions with Variable-length Argument ListsInformation in this article applies to:
QUESTIONCan you clarify the requirements on the number of bytes passed to functions with variable-length argument lists (like the printf function) when using the C51 compiler? ANSWERPrograms are created using C51 pass arguments in fixed memory locations. Arguments are not passed on the stack. For this reason, there are some limitations placed on functions, like printf, that utilize a variable-length argument list (vararg).
You may use the MAXARGS compiler directive to change the number of bytes reserved. Note, however, that large numbers will rapidly consume memory in SMALL and COMPACT memory models. MAXARGS has no influence on library functions which are using variable argument lists (example: printf, scanf...). The number of bytes of reserved space refers to how many bytes the arguments to the function require. For example:
takes three (3) arguments: the format string, the integer i, and the char pointer s. So, the above printf function call needs 8 bytes for its arguments as shown below.
Note that the requirements and limitations placed on variable-length argument lists do not apply to reentrant functions. MORE INFORMATION
SEE ALSO
Last 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.