-
Notifications
You must be signed in to change notification settings - Fork 317
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
nrf_rpc: fix build error for C++ #1514
base: main
Are you sure you want to change the base?
Conversation
In C++, conversion from a function pointer to void* is either undefined (prior to C++11) or not implicit. Replace the cast from a function pointer to (void*) with a cast to (uintptr_t) to fix build errors when including nrf_rpc.h in C++ applications. Signed-off-by: Damian Krolik <[email protected]>
Why is C code built by C++ compiler? |
Because Matter firmware needs to include |
I do not think that I do not like forced typecasting since it might dig in deep the type mismatching. Would it be more meaningful to move inline functions into C file and remove |
As long as the inline functions don't use any C-only features like compound literals, there's no issue with that, no? Moving the functions to C file will not remove the casts. To make it 100% type-safe I would probably need to duplicate some code, which contradicts the authors' intention to optimize the code size of this fragment. |
Discussed IRL. Let it be but for future to be accurate with potential miscasting in such functions. |
In C++, conversion from a function pointer to void* is either undefined (prior to C++11) or not implicit.
Replace the cast from a function pointer to (void*) with a cast to (uintptr_t) to fix build errors when including nrf_rpc.h in C++ applications.