Using mrb_funcall_argv()
instead of mrb_funcall_id()
#5804
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
mrb_funcall_id()
is an attractive and easy-to-use function, but it requires more stack space. This is because themrb_funcall_id()
function takes variable-length arguments and also requires copying to a fixed-length array.If the
mrb_funcall_argv()
function is called directly, stack consumption can be avoided. However, it requires an array to be defined, making it less usable.Therefore, the
MRB_FUNCALL()
macro function is introduced to improve usability. This is for internal implementation at this time, because if the number of arguments is wrong, the error will be hard to understand at compile time.Currently, only calls with up to 4 arguments are made. For reserve purposes, calls with up to 6 arguments are valid. Calls with 7 to 13 arguments will output a "function not defined" error at compile time. For 14 or more arguments, a seemingly inexplicable error is output.