1: # define offsetof(T, F) ((unsigned int)((char *)&((T *)0)->F))
To understand, we are typecasting address NULL to type T and then computing the address of field F. Since the compiler knows about the layout of type T, hence it can compute this value during compilation and fill in wherever this is required. This is not computed at run-time.
No comments:
Post a Comment