[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1635127.Ytukyo95FQ@bentobox>
Date: Mon, 14 Jan 2013 11:46:05 +0100
From: Schrober <franzschrober@...oo.de>
To: linux-kernel@...r.kernel.org
Subject: container-of Implementation
Hi,
I wondered why the container_of implementation is so complicated.
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
isn't the __mptr not unnecessary? Why not following version?
#define container_of(ptr, type, member) \
((type *)((char *)(ptr) - offsetof(type, member)))
--
Franz Schrober
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists