[Top][All Lists]
[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: |
Jes Sorensen |
Subject: |
Re: [Qemu-devel] Re: [PATCH 04/14] Zero initialize timespec struct explicitly |
Date: |
Mon, 30 Aug 2010 19:38:30 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.2 |
On 08/30/10 18:56, malc wrote:
> On Mon, 30 Aug 2010, Anthony Liguori wrote:
>
>> On 08/30/2010 10:35 AM, address@hidden wrote:
>>> From: Jes Sorensen<address@hidden>
>>> 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.
>>
>
> Apart from gcc complaining about fields not being initialized explicitly
> there's nothing wrong with it.
Sure it compiles, it works, but it's not pretty. What does it mean if
you write = { 1 } in the above case?
Anyway the whole point of my patch is this, if we fix things like these,
we are much more likely to be able to catch real bugs using some of
gcc's checking. The patch I submitted is harmless code wise, but it
makes it that bit easier to catch other bugs in the code. In my book
that adds a lot of value.
Jes
- [Qemu-devel] [PATCH 02/14] Respect return value from nbd_client(), (continued)
- [Qemu-devel] [PATCH 02/14] Respect return value from nbd_client(), Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 13/14] Change DPRINTF() to do{}while(0) to avoid compiler warning, Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 14/14] load_multiboot(): get_image_size() returns int, Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 07/14] Remove unused argument for get_whole_cluster(), Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 03/14] Fix repeated typo: was "end if list" instead of "end of list", Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 04/14] Zero initialize timespec struct explicitly, Jes . Sorensen, 2010/08/30
[Qemu-devel] [PATCH 12/14] size_t is unsigned, so (foo >= 0) is always true, Jes . Sorensen, 2010/08/30
Re: [Qemu-devel] [PATCH 00/14] gcc extra warning fixes, Blue Swirl, 2010/08/30