Re: [patch 1/1] sizeof(*dev) : arch/arm/common/sa1111.c

From: Russell King
Date: Fri Jul 01 2005 - 05:05:26 EST


On Thu, Jun 30, 2005 at 11:58:19PM +0200, domen@xxxxxxxxxxxx wrote:
> when using sizeof consider using the variable and not the type, that way
> if the type of the variable is changed we don't have to go seaching
> all instances of sizeof(type).

This is a matter of taste, and I decided upon sizeof(type) after a
discussion with Al Viro on this subject.

I believe the overwealming argument for sizeof(type) as opposed to
sizeof(expression) is that you can identify easily where likely
initialisations happen, and therefore places which need to be
properly updated if/when you change the type.

I'm also sending this to Al so he can give his point of view on
sizeof(type) vs sizeof(expression).

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/