qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH 04/14] Zero initialize timespec struct expli


From: malc
Subject: Re: [Qemu-devel] Re: [PATCH 04/14] Zero initialize timespec struct explicitly
Date: Mon, 30 Aug 2010 21:04:00 +0400 (MSD)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)

On Mon, 30 Aug 2010, Jes Sorensen wrote:

> On 08/30/10 17:43, Anthony Liguori wrote:
> > On 08/30/2010 10:35 AM, address@hidden wrote:
> >> From: Jes Sorensen<address@hidden>
> >>
> >> Signed-off-by: Jes Sorensen<address@hidden>
> >> ---
> >>   linux-aio.c |    2 +-
> >>   1 files changed, 1 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/linux-aio.c b/linux-aio.c
> >> index 68f4b3d..3240996 100644
> >> --- a/linux-aio.c
> >> +++ b/linux-aio.c
> >> @@ -118,7 +118,7 @@ static void qemu_laio_completion_cb(void *opaque)
> >>           struct io_event events[MAX_EVENTS];
> >>           uint64_t val;
> >>           ssize_t ret;
> >> -        struct timespec ts = { 0 };
> >> +        struct timespec ts = { 0, 0 };
> >>    
> > 
> > I don't like these.  What's wrong with { } or { 0 }?  Implicit zeroing
> > of members is a critical feature of structure initialization so if there
> > is something wrong with this, it's important to know why because
> > otherwise we've got a massive amount of broken code.
> 
> The specific case above is really inconsistent. Either do {} or {0, 0},
> doing just {0} means it is initializing just one element in the struct.
> That is broken IMHO.
> 

No it doesn't mean that. In this particular case all the fields of ts
will be set to zero, for specific wording look at 6.7.9#21

-- 
mailto:address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]