From b35101db5fd295f98fd8e10547e72765e320f76a Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Mon, 7 Sep 2015 08:08:01 +0000 Subject: [PATCH] [XDK] add cpp security checks for RTL_NUMBER_OF_V2/ARRAYSIZE svn path=/trunk/; revision=69080 --- reactos/include/xdk/ntbasedef.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reactos/include/xdk/ntbasedef.h b/reactos/include/xdk/ntbasedef.h index 5261b37aea9..ff8d6ec06c3 100644 --- a/reactos/include/xdk/ntbasedef.h +++ b/reactos/include/xdk/ntbasedef.h @@ -680,8 +680,11 @@ typedef struct _GROUP_AFFINITY { #define RTL_NUMBER_OF_V2(A) \ (({ int _check_array_type[__builtin_types_compatible_p(typeof(A), typeof(&A[0])) ? -1 : 1]; (void)_check_array_type; }), \ RTL_NUMBER_OF_V1(A)) +#elif defined(__cplusplus) + template + char (& SAFE_RTL_NUMBER_OF(T (&)[N]))[N]; + #define RTL_NUMBER_OF_V2(A) sizeof(SAFE_RTL_NUMBER_OF(A)) #else - /// \todo implement security checks for cplusplus / MSVC #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A) #endif