From 71e53c2e606d52502210bc5af67706eefcd4c1d4 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 6 Mar 2019 20:10:58 -0500 Subject: maybe better test for offsetof() --- stddef.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stddef.c b/stddef.c index 73f0dfd..c42abf3 100644 --- a/stddef.c +++ b/stddef.c @@ -12,11 +12,13 @@ void test_stddef_h(void) char b; }; + static struct s the_s; + testing_header("stddef.h"); test_true(NULL == 0); - test_int_equals(offsetof(struct s, b), 1); + test_int_equals(offsetof(struct s, b), (char*)&(the_s.b) - (char*)&the_s); testing_end(); } -- cgit v1.2.1