News for hackers. Stuff that matters.
Re:Null Pointer Dereferencing Causes Undefined Behavior by madmoose on Monday April 20, 2015 @06:01PM (#9411130)
Your compiler probably has a built-in method to achieve the equivalent of offsetof without invoking undefined behavior.

GCC has __builtin_offsetof: https://gcc.gnu.org/onlinedocs/gcc/Offsetof.html

Re:Null Pointer Dereferencing Causes Undefined Behavior by masklinn on Tuesday April 21, 2015 @07:59AM (#9413409)
offsetof is part of C89 stddef.h, why would you call the underlying GCC-specific __builtin_offsetof? Just call offsetof that's what it's here for, __builtin_offsetof is the GCC implementation detail.