- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Return null instead of aborting in C API by extending ffi_fn! macro #2478
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
Conversation
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.
Awesome start! I left some thoughts inline.
How do we want to deal with functions that return |
Can we mark them as |
1b5c59c
to
0dddb29
Compare
Make C API functions that return pointers return null in case of a panic, instead of aborting. Add ffi_fn! macro rules that enable default error values to be returned by writing "?= <value>" after an ffi function's body.
Supports |
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.
Awesome work, thanks for starting this! I think we can do follow up PRs to add this to more of the functions (and then eventually remove the ability to have forgotten).
…#2478) Make C API functions that return pointers return null in case of a panic, instead of aborting. Add ffi_fn! macro rules that enable default error values to be returned by writing "?= <value>" after an ffi function's body.
Make C API functions that return pointers return null in case of a
panic, instead of aborting.
Add ffi_fn! macro rules that enable error values to be returned by
writing "?= " or "?: " after an ffi function's body.
Incremental to #2397