Re: [PATCH 09/12] samples: configfs: prefer sizeof(*var) to sizeof(struct var_type)

From: Christoph Hellwig
Date: Wed Oct 07 2020 - 09:46:18 EST


On Thu, Sep 24, 2020 at 02:45:23PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
>
> It's better to use the size of the actual variable than its type when
> allocating memory. This also has the benefit of avoiding a line break
> here.

Either style has up an downside. The variable based on tracks type
changes automatically, but on the other hand leads to lots of bugs
where people forget the *. I'd rather not just change from one to
the other pointlessly.