Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-132097: use a macro for semantically casting function pointers#132406
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
09fb7158a2e2a6f6d6df32153507efa7bdc4bcff7f398e1398f567faFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -36,6 +36,16 @@ | ||
| // Macro to use the more powerful/dangerous C-style cast even in C++. | ||
| #define _Py_CAST(type, expr) ((type)(expr)) | ||
| // Cast a function to another function type T. | ||
| // | ||
| // The macro first casts the function to the "void func(void)" type | ||
| // to prevent compiler warnings. | ||
| // | ||
| // Note that using this cast only prevents the compiler from emitting | ||
| // warnings, but does not prevent an undefined behavior at runtime if | ||
| // the original function signature is not respected. | ||
| #define _Py_FUNC_CAST(T, func) _Py_CAST(T, _Py_CAST(void(*)(void), (func))) | ||
picnixz marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // Static inline functions should use _Py_NULL rather than using directly NULL | ||
| // to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer, | ||
| // _Py_NULL is defined as nullptr. | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.