Hi ctmzb, On Sat, Dec 24, 2011 at 10:34 AM, contemplating zombie <contemplatingzombie@xxxxxxxxx> wrote: > Hi, > > I see following code in kfifo.h > > typeof((fifo) + 1) __tmp = (fifo); > [http://lxr.linux.no/linux+v3.1.6/include/linux/kfifo.h#L334] > > I do not understand this specific code construct. Why is it necessary > to add 1 to fifo before getting its type? > Is it related to some 'C' magic? This has to do with the difference between arrays and pointers. int *x; int y[5]; have different types. y by itself has an array type. y + 1 is the same as &y[1] which has an int * type. If we assume that an int is 32 bits and an int * is 32 bits then sizeof( typeof( x )) = 4 sizeof( typeof( y )) = 20 sizeof( typeof( (x) + 1 ) = 4 sizeof( typeof( (y) + 1 ) = 4 -- Dave Hylands Shuswap, BC, Canada http://www.davehylands.com _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies