-
Notifications
You must be signed in to change notification settings - Fork 688
Closed
Description
Zephyr.js has a nice macro to declare const jerry_value_ts. It leverages the __attribute__ ((__cleanup__(...))) feature to automatically call jerry_release_value() on the value when the variable goes out of scope:
Example use:
... {
ZVAL global = jerry_get_global_object();
...
// no need to call jerry_release_value(global);
// it will be released automatically by the cleanup function.
}
The advantages are quite obvious I think. The disadvantage is that it needs to be supported by the compiler. FWIW, GCC and clang support it.
Does it make sense to add a similar utility to jerry-ext?
Metadata
Metadata
Assignees
Labels
No labels