Skip to content
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

[libc] casting macro for user headers #127238

Open
nickdesaulniers opened this issue Feb 14, 2025 · 1 comment
Open

[libc] casting macro for user headers #127238

nickdesaulniers opened this issue Feb 14, 2025 · 1 comment
Labels

Comments

@nickdesaulniers
Copy link
Member

@enh-google saw our endian.h and mentioned __BIONIC_CAST.
https://android.googlesource.com/platform/bionic/+/main/libc/include/sys/cdefs.h#57

#if defined(__cplusplus)
#define __BIONIC_CAST(_k,_t,_v) (_k<_t>(_v))
#else
#define __BIONIC_CAST(_k,_t,_v) ((_t) (_v))
#endif

maybe interesting to add that to libc/include/__llvm-libc-common.h and use more in our user facing headers.

@llvmbot
Copy link
Member

llvmbot commented Feb 14, 2025

@llvm/issue-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

@enh-google saw our endian.h and mentioned `__BIONIC_CAST`. https://android.googlesource.com/platform/bionic/+/main/libc/include/sys/cdefs.h#57 ```c++ #if defined(__cplusplus) #define __BIONIC_CAST(_k,_t,_v) (_k<_t>(_v)) #else #define __BIONIC_CAST(_k,_t,_v) ((_t) (_v)) #endif ``` maybe interesting to add that to libc/include/__llvm-libc-common.h and use more in our user facing headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants