[winpr,winpr.h] static assert WINPR_REINTERPRET_CAST

This commit is contained in:
akallabeth
2024-12-08 21:57:09 +01:00
parent f63a5a5a1f
commit 33a125d4a3

View File

@@ -145,15 +145,16 @@ WINPR_API const char* winpr_get_build_config(void);
* @return The casted pointer
* @since version 3.9.0
*/
#define WINPR_REINTERPRET_CAST(ptr, srcType, dstType) \
__extension__({ \
union \
{ \
srcType src; \
dstType dst; \
} cnv; \
cnv.src = ptr; \
cnv.dst; \
#define WINPR_REINTERPRET_CAST(ptr, srcType, dstType) \
__extension__({ \
union \
{ \
srcType src; \
dstType dst; \
} cnv; \
WINPR_STATIC_ASSERT(sizeof(srcType) == sizeof(dstType)); \
cnv.src = ptr; \
cnv.dst; \
})
/**