From 25ab59bf809c3133a3cf69afd4a57756fdba43a8 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 23 Nov 2015 07:11:05 -0600 Subject: [PATCH] stddef.h: Use a round-about cast in the definition of offsetof() to avoid warnings on machines with 64 bit addresses and when size_t is less than 64-bits. --- include/stddef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/stddef.h b/include/stddef.h index ecc5eb94ce..bcd09d249b 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -65,7 +65,7 @@ * Reference: Opengroup.org */ -#define offsetof(a,b) ((size_t)(&(((a *)(0))->b))) +#define offsetof(type, member) ((size_t)(uintptr_t)&(((type *)0)->member)) /**************************************************************************** * Type Definitions