qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: malc <av1474@comtv.ru>
To: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH 04/14] Zero initialize timespec struct explicitly
Date: Mon, 30 Aug 2010 21:04:00 +0400 (MSD)	[thread overview]
Message-ID: <alpine.LNX.2.00.1008302059150.1726@linmac> (raw)
In-Reply-To: <4C7BD46B.8090106@redhat.com>

On Mon, 30 Aug 2010, Jes Sorensen wrote:

> On 08/30/10 17:43, Anthony Liguori wrote:
> > On 08/30/2010 10:35 AM, Jes.Sorensen@redhat.com wrote:
> >> From: Jes Sorensen<Jes.Sorensen@redhat.com>
> >>
> >> Signed-off-by: Jes Sorensen<Jes.Sorensen@redhat.com>
> >> ---
> >>   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:av1474@comtv.ru

  reply	other threads:[~2010-08-30 17:04 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30 15:35 [Qemu-devel] [PATCH 00/14] gcc extra warning fixes Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 01/14] Remove unused argument for nbd_client() Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 02/14] Respect return value from nbd_client() Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 03/14] Fix repeated typo: was "end if list" instead of "end of list" Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 04/14] Zero initialize timespec struct explicitly Jes.Sorensen
2010-08-30 15:43   ` [Qemu-devel] " Anthony Liguori
2010-08-30 15:55     ` Jes Sorensen
2010-08-30 17:04       ` malc [this message]
2010-08-30 16:56     ` malc
2010-08-30 17:38       ` Jes Sorensen
2010-08-30 17:41         ` Anthony Liguori
2010-08-30 17:43         ` malc
2010-08-30 15:35 ` [Qemu-devel] [PATCH 05/14] Remove unused argument for check_for_block_signature() Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 06/14] Remove unused argument for encrypt_sectors() Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 07/14] Remove unused argument for get_whole_cluster() Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 08/14] Remove unused argument for qcow2_encrypt_sectors() Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 09/14] Remove unused arguments for add_aio_request() and free_aio_req() Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy Jes.Sorensen
2010-08-30 15:39   ` [Qemu-devel] " Anthony Liguori
2010-08-30 15:43     ` Jes Sorensen
2010-08-30 15:48       ` Anthony Liguori
2010-08-30 15:53         ` Jes Sorensen
2010-08-30 17:12           ` Avi Kivity
2010-08-30 16:55         ` Nathan Froyd
2010-08-30 18:00           ` Jes Sorensen
2010-08-30 17:06         ` malc
2010-08-30 19:32         ` Richard Henderson
2010-08-30 15:42   ` Paolo Bonzini
2010-08-30 16:15     ` Anthony Liguori
2010-08-30 16:18       ` Paolo Bonzini
2010-08-30 16:29         ` Anthony Liguori
2010-08-30 16:35           ` Paolo Bonzini
2010-08-30 18:05           ` Jes Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 11/14] Remove unused function arguments Jes.Sorensen
2010-08-30 16:24   ` [Qemu-devel] " Paolo Bonzini
2010-08-30 17:13     ` Anthony Liguori
2010-08-30 15:35 ` [Qemu-devel] [PATCH 12/14] size_t is unsigned, so (foo >= 0) is always true Jes.Sorensen
2010-08-30 15:41   ` [Qemu-devel] " Anthony Liguori
2010-08-30 15:35 ` [Qemu-devel] [PATCH 13/14] Change DPRINTF() to do{}while(0) to avoid compiler warning Jes.Sorensen
2010-08-30 15:35 ` [Qemu-devel] [PATCH 14/14] load_multiboot(): get_image_size() returns int Jes.Sorensen
2010-08-30 19:25 ` [Qemu-devel] [PATCH 00/14] gcc extra warning fixes Blue Swirl
2010-08-31  7:21   ` Jes Sorensen
2010-08-31 17:43     ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1008302059150.1726@linmac \
    --to=av1474@comtv.ru \
    --cc=Jes.Sorensen@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).