[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kernel-janitors
Subject:    Re: [PATCH 05/56] block: Remove void casts
From:       Joe Damato <ice799 () gmail ! com>
Date:       2009-04-16 23:56:58
Message-ID: 3605561d0904161656r66e6b2a4q32b354ea15ad4742 () mail ! gmail ! com
[Download RAW message or body]

On Thu, Apr 16, 2009 at 2:16 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Sat, Apr 11, 2009 at 02:55:32PM +0200, walter harms wrote:
>>
>>
>> Al Viro schrieb:
>> > On Wed, Apr 08, 2009 at 01:31:43PM +0200, Bert Wesarg wrote:
>> >> If typeof(c) == CommandList_struct*, that you could replace
>> >> sizeof(CommandList_struct) with sizeof(*c) to make the expression
>> >> shorter and fit into one line.
>> >
>> > This is not commonly accepted as a good thing.  In particular, I would
>> > seriously ask you to avoid doing anything of that kind around fs/*
>>
>> just for the curious ...
>> What is the dark side of replacing ?
>> foo=malloc(sizeof(struct fo)) -> foo=malloc(sizeof( *foo) ))
>
> The latter is ungreppable.

For the curious, round 2: I was under the impression (perhaps
incorrectly) that sizeof(*foo) was useful because if the type of foo
changes (say from struct fo to struct new_fo), you do not need to go
fishing around the source changing all the "struct fo" to "struct
new_fo."

This probably doesn't matter though if all the other code is already
doing sizeof(struct fo), because you'll have to go fishing anyway.

Joe
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic