lkml.org 
[lkml]   [2012]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv2 6/6] media: Convert struct i2c_msg initialization to C99 format
On Tue 18 Sep 2012 03:02:42 AM PDT, Venu Byravarasu wrote:
>> -----Original Message-----
>> From: Shubhrajyoti Datta [mailto:omaplinuxkernel@gmail.com]
>> Sent: Tuesday, September 18, 2012 3:30 PM
>> To: Venu Byravarasu
>> Cc: Shubhrajyoti D; linux-media@vger.kernel.org; linux-
>> kernel@vger.kernel.org; julia.lawall@lip6.fr
>> Subject: Re: [PATCHv2 6/6] media: Convert struct i2c_msg initialization to C99
>> format
>
>>>> struct i2c_msg test[2] = {
>>>> - { client->addr, 0, 3, write },
>>>> - { client->addr, I2C_M_RD, 2, read },
>>>> + {
>>>> + .addr = client->addr,
>>>> + .flags = 0,
>>>
>>> Does flags not contain 0 by default?
>>>
>>
>> It does however I felt that 0 means write so letting it be explicit.
>>
>> In case a removal is preferred that's doable too however felt it is
>> more readable this way.
>
> Though it adds readability, it carries an overhead of one write operation too.
> So, better to remove it.

Partially initialized structs will have their unmentioned members
initialized to zero.

So there is no "overhead of one write operation" by mentioning it
explicitly.



\
 
 \ /
  Last update: 2012-09-18 22:41    [W:3.114 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site