-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Remove VARIANT_ARG* macros #58929
Remove VARIANT_ARG* macros #58929
Conversation
reduz
commented
Mar 9, 2022
- Very old macros from the time Godot was created.
- Limited arguments to 5 (then later changed to 8) in many places.
- They were replaced by C++11 Variadic Templates.
- Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
- Also added a dereference check for Variant*. Helped catch a couple of bugs.
@@ -125,7 +111,7 @@ Error MessageQueue::push_set(Object *p_object, const StringName &p_prop, const V | |||
return push_set(p_object->get_instance_id(), p_prop, p_value); | |||
} | |||
|
|||
Error MessageQueue::push_callable(const Callable &p_callable, const Variant **p_args, int p_argcount, bool p_show_error) { | |||
Error MessageQueue::push_callablep(const Callable &p_callable, const Variant **p_args, int p_argcount, bool p_show_error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now it's fine for compatibility, but eventually we could likely remove the args pointer and just make it push_callable(const Callable &p_callable, bool p_show_error)
. We can pass args via Callable::bind
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I am honestly not sure how it is supposed to be used, although the unlimited varargs now should resolve most of the original need for it.
4577d69
to
933a77a
Compare
933a77a
to
7bbac9a
Compare
7bbac9a
to
58360b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from my last comment, this seems good to merge if it passes CI.
* Very old macros from the time Godot was created. * Limited arguments to 5 (then later changed to 8) in many places. * They were replaced by C++11 Variadic Templates. * Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard. * Also added a dereference check for Variant*. Helped catch a couple of bugs.
58360b8
to
21637df
Compare
Thanks! |
argptrs.write[i] = &op.args[i]; | ||
argc++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug here, argc
is now always 0. I'll make a PR.