offsetof
can lead to undefined behavior when the argument types are incompatible or when bit fields are used. Therefore
offsetof
should be avoided.
Noncompliant code example
#include <stddef.h>
struct A
{
int32_t i;
};
void f1 ( )
{
offsetof ( A, i ); // Noncompliant
}