From a3d7a8fe7185cb568b2832b858c2f5b69e63789c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 16 Oct 2015 06:50:41 +0200 Subject: m offsetof doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- include/stddef.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/stddef.h b/include/stddef.h index 696af02..e33cfed 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -72,7 +72,10 @@ #define offsetof(type, member) \ ((size_t)((char*)&(((type*)NULL)->member) - (char*)NULL)) /* TODO The behaviour of this is undefined, and a builtin function - * shall be used when available. That would also improve diagnostics. */ + * shall be used when available. That would also improve diagnostics. + * If compilers that support ({ }), NULL could be replaced with a + * temporary variable, this would only remove the undefined behaviour, + * but any serious compiler should support the current implementation. */ -- cgit v1.2.3-70-g09d2