Re: Fwd: Question about container_of macro. | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Thu, 17 Jan 2008, Manish Katiyar wrote:
> My question is instead of defining container_of as:
>
> #define container_of(ptr, type, member) ({ \
> const typeof( ((type *)0)->member ) *__mptr = (ptr);
> (type *)( (char *)__mptr - offsetof(type,member) );})
>
>
> Why won't this simply work :
>
> #define container_of(ptr, type, member) ({ \
> (type *)( (char *)(ptr) - offsetof(type,member) );})
Indeed, or even this:
#define container_of(ptr, type, member) \
((type *) ((char *)(ptr) - offsetof(type,member)))
Alan Stern
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
[Home] [Video for Linux] [Photo] [Yosemite Forum] [Yosemite Photos] [Video Projectors] [PDAs] [Hacking TiVo] [Linux Kernel] [Linux SCSI] [XFree86] [Devices] [Big List of Linux Books] [Free Dating]
![]() |