I am trying to declare a struct that is dependent upon another struct. I want to use sizeof to be safe/pedantic.
sizeof
typedef struct _parent { floa
You are free to use FIELD_SIZEOF(t, f) in the Linux kernel. It's just defined as following:
FIELD_SIZEOF(t, f)
#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
This type of macro is mentioned in other answers. But it's more portable to use an already-defined macro.