Re: [PATCH 1/2] iWARP Connection Manager.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



so be it.

iwcm.c and the ammasso files will all use sizeof().

Steve.


On Wed, 2006-05-31 at 14:54 -0700, Roland Dreier wrote:
> This is a silly thing to argue about, but...
> 
>  > The preferred form for passing a size of a struct is the following:
>  > 
>  > 	p = kmalloc(sizeof(*p), ...);
>  > 
>  > The alternative form where struct name is spelled out hurts readability and
>  > introduces an opportunity for a bug when the pointer variable type is changed
>  > but the corresponding sizeof that is passed to a memory allocator is not.
> 
> I would argue that this is talking about sizeof(*p) vs. sizeof (struct foo)
> rather than sizeof(*p) vs. sizeof *p.
> 
> You wouldn't write:
> 
> 	return(*p);
> 
> but rather
> 
> 	return *p;
> 
> And sizeof is an operator not a function, so I think the same usage
> would apply.
> 
> With that said the prevalent kernel usage does seem to be sizeof(*foo)
> (by about 10 to 1).  But I can't help feeling it looks silly.
> 
>  - R.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux