I need to detect by a macro at compile time if a struct has a member. I've tried offsetof(struct object, a_field)
but it causes error to be issued at compilation about non existing field. Is there some other method to check if a C struct has a field?
I need this for a macro
MESSAGE(obj, method, ...) obj->method(obj, ##__VA_ARGS);
So that I could use it also on non virtual methods, like:
MESSAGE(obj, method, ...) method(obj, ##__VA_ARGS);
So in general to detect if there is method
member and if so, call it as obj->member(obj, …)
and as member(obj, …)
otherwise.