#define offsetof(type, member) ((size_t)(&((type *)0)->member))
I am not understanding (&((type *)0)->member)
what is this exactly telling me.....
here type may be a structure or something else??...
More specifically what is that 0 telling me here??
If you have tasks in Microsoft Excel that you do repeatedly, you can record a macro to automate those tasks. A macro is an action or a set of actions that you can run as many times as you want. When you create a macro, you are recording your mouse clicks and keystrokes.
While tracking is important, there is no need to stress about hitting your macros exactly every single day. As long as you don't go over each macronutrient by more than 5 grams, or under by more than 10 grams, you should still see results.
A macro is a set of instructions used to execute repetitive tasks. You can record a set of commands and then play them back with one or two keystrokes. That means that you can save A LOT of time when doing routine and repetitive tasks.
This is to determine the offset of a struct field. It works by using 0 as the address of the struct, then asking for the address of the field:
(type *)0
is 0 as a pointer to type
&((type *)0)->member
is the address of that hypothetical struct's member
member. If the address of the struct is 0, then the address of the member is the same as the offset from the beginning of the struct.
((size_t)(&((type *)0)->member))
is that address cast to a size_t
to be the proper type for an offset.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With