From 2f386c19d96ab774467e0e97e8c032441e08ced8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 9 Jan 2026 22:56:30 +0900 Subject: feat: add offsetof() to stddef.h --- include/stddef.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/stddef.h') diff --git a/include/stddef.h b/include/stddef.h index 5ebdf7a..ffcf225 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -7,9 +7,10 @@ typedef unsigned long size_t; typedef int wchar_t; typedef long ptrdiff_t; +#define offsetof(T, m) (ptrdiff_t)((void*)((T*)0)->m) + // TODO: // - max_align_t (C11) // - nullptr_t (C23) -// - offsetof #endif -- cgit v1.2.3-70-g09d2