[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 10 Oct 2016 09:09:19 -0400
From: Jes Sorensen <Jes.Sorensen@...hat.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Richard Weinberger <richard.weinberger@...il.com>,
SF Markus Elfring <elfring@...rs.sourceforge.net>,
"linux-raid\@vger.kernel.org" <linux-raid@...r.kernel.org>,
Christoph Hellwig <hch@....de>,
Guoqing Jiang <gqjiang@...e.com>, Jens Axboe <axboe@...com>,
Mike Christie <mchristi@...hat.com>,
Neil Brown <neilb@...e.com>, Shaohua Li <shli@...nel.org>,
Tomasz Majchrzak <tomasz.majchrzak@...el.com>,
LKML <linux-kernel@...r.kernel.org>,
"kernel-janitors\@vger.kernel.org" <kernel-janitors@...r.kernel.org>,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf()
Dan Carpenter <dan.carpenter@...cle.com> writes:
> On Thu, Oct 06, 2016 at 11:29:20AM +0200, Richard Weinberger wrote:
>> On Thu, Oct 6, 2016 at 11:22 AM, SF Markus Elfring
>> <elfring@...rs.sourceforge.net> wrote:
>> > From: Markus Elfring <elfring@...rs.sourceforge.net>
>> > Date: Tue, 4 Oct 2016 21:46:18 +0200
>> >
>> > Replace the specification of a data structure by a pointer dereference
>> > as the parameter for the operator "sizeof" to make the corresponding size
>> > determination a bit safer.
>>
>> Isn't this pure matter of taste?
>> Some developers prefer sizeof(*ptr) because it is easier to type, other
>> developers prefer sizeof(struct foo) because you can determine the type
>> at first sight and makes review more easy.
>
> sizeof(*ptr) is more future proof and normally more obvious and easier
> to review. That said, I've tried to tell Markus to only send bugfix
> patches because these are a waste of time and regularly introduce bugs.
This is totally a matter of taste. I for one find it way easier to
review something which says 'sizeof(struct ....)' because it stands out
more. I am curious what you mean by it being more future proof - if the
code says 'struct foo' in the sizeof argument, what is the problem?
The one area where there is a higher risk is if the type is changed, but
that is outweighed by the fact the spelled out version is easier to
review.
Jes
Powered by blists - more mailing lists