Skip to contentSkip to conversation

sizeof(*dev) : arch/arm/common/sa1111.c

PATCH Russell King 1 participant 1 message Jul 1, 2005 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 3 lines · On Thu, Jun 30, 2005 at 11:58:19PM +0200, [email protected] 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).

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core