Need to get the offset between a struct and one of it's fields in C -


The subject may also be titled "Is there enough size to catch an address?"

I am trying to get an offset from a strat and its fields and I am using an size_t variable to hold the offset:

  Size_t offset = (size_t) and struct.field - (size_t) and structure;   

I know that this is a form of compulsion, I am just thinking that I may have to face some kind of error later because this is why I know that I I could do this by using an int, but I'm wondering if he can keep an eye on the 64 bit system.

What are your thoughts on this?

offsetfile macro's & lt; Stddef.h & gt; Found in .

Since size_t has enough substantial limits to store the size of the largest possible object, it is enough to offset any type of offset of any kind Has: Offset can not be more than the structure size of a composition member.

Comments