On 11/09/10 17:49, Bond wrote:
(type *)( (char *)__mptr - offsetof(type,member) );})
there a subtraction has been done why is this subtraction done?
Not having read any of the documentation, what comes to mind is this:
if __mptr is a pointer to the member of a structure, the above
expression returns a pointer to the first byte of the containing
structure, typecast to the type of the structure.
Example:
typedef struct {
int a;
char b;
} test_t;
test_t test;
Now assume that __mptr is a pointer to test.b, then the above expression
returns a pointer to test, i.e. a pointer to the structure that b is a
member of.
Jan
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ