On Mon, 2012-07-09 at 15:23 -0700, David Rientjes wrote: > On Mon, 9 Jul 2012, a...@linux-foundation.org wrote: > > > From: Joe Perches <j...@perches.com> > > Subject: checkpatch: Add acheck for use of sizeof without parenthesis > > > > Kernel style uses parenthesis around sizeof. > > > > Nack, there's a difference between "sizeof *task" and > "sizeof(struct task_struct)". The former operates on a unary expression > and the latter operates on a type. There are over 1000 occurrences in the > kernel where the sizeof operator, the former, is used on a unary > expression.
Huh? Maybe I misunderstand you. $ cat sizeof.c #include <stdio.h> #include <stdlib.h> #include <strings.h> struct foo { int bar[20]; char *baz; }; int main(int argc, char **argv) { struct foo bar; struct foo *baz; printf("1: %zu\n", sizeof(struct foo)); printf("2: %zu\n", sizeof bar); printf("3: %zu\n", sizeof *baz); return 0; } $ gcc sizeof.c $ ./a.out 1: 84 2: 84 3: 84 > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/