Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using mrb_funcall_argv() instead of mrb_funcall_id() #5804

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 30, 2022

  1. Using mrb_funcall_argv() instead of mrb_funcall_id()

    `mrb_funcall_id()` is an attractive and easy-to-use function, but it requires more stack space.
    This is because the `mrb_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.
    
    Also, `mrb_static_assert_expand()` has been renamed to `MRB_VA_EXPAND()` and moved to `include/mruby/common.h`.
    dearblue committed Oct 30, 2022
    Configuration menu
    Copy the full SHA
    981e2e7 View commit details
    Browse the repository at this point in the history