[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] When to use qemu/typedefs.h
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] When to use qemu/typedefs.h |
Date: |
Wed, 31 Jul 2019 10:40:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 |
On 31/07/2019 08.37, Markus Armbruster wrote:
> Paolo Bonzini <address@hidden> writes:
>
>> On 30/07/19 15:15, Eric Blake wrote:
>>>> We occasionally give up and use types directly rather than their typedef
>>>> names, flouting the coding style. This patch does. Trades messing with
>>>> qemu/typedefs.h for having to write 'struct' a few times.
>>
>> I think Markus made the right call here. Using "struct Foo;" in headers
>> is a null price to pay if all you need is declaring a pointer-typed
>> field or parameter.
>
> Eduardo posted a patch to HACKING to clarify this non-usage of typedef
> is okay.
>
> Should we continue to mandate typedef names elsewhere? It adds
> cognitive load: you have to decide where to put the typedef, and when
> not to use it.
IMHO we should get rid of mandating typedefs. They are causing too much
trouble - e.g. do you also remember the issues with duplicated typedefs
in certain compiler versions in the past? (these should be hopefully
gone now, but still...)
And many QEMU developers are also working on the Linux kernel, which
rather forbids typedefs. Having to switch your mind back and forth
whether to use typedefs or not is really annoying.
So if you ask me, stop mandating it! It's ok as optional feature in QEMU
for types that are used all over the place, but we really should not
enforce it for each and every struct anymore.
Thomas
- [Qemu-devel] [PATCH 23/28] numa: Don't include hw/boards.h into sysemu/numa.h, (continued)
- [Qemu-devel] [PATCH 23/28] numa: Don't include hw/boards.h into sysemu/numa.h, Markus Armbruster, 2019/07/26
- Re: [Qemu-devel] [PATCH 23/28] numa: Don't include hw/boards.h into sysemu/numa.h, Eduardo Habkost, 2019/07/29
- [Qemu-devel] When to use qemu/typedefs.h (was: [PATCH 23/28] numa: Don't include hw/boards.h into sysemu/numa.h), Markus Armbruster, 2019/07/30
- Re: [Qemu-devel] When to use qemu/typedefs.h (was: [PATCH 23/28] numa: Don't include hw/boards.h into sysemu/numa.h), Eric Blake, 2019/07/30
- Re: [Qemu-devel] When to use qemu/typedefs.h (was: [PATCH 23/28] numa: Don't include hw/boards.h into sysemu/numa.h), Paolo Bonzini, 2019/07/30
- [Qemu-devel] [RFC] HACKING: Document 'struct' keyword usage, Eduardo Habkost, 2019/07/30
- Re: [Qemu-devel] [RFC] HACKING: Document 'struct' keyword usage, Eric Blake, 2019/07/30
- Re: [Qemu-devel] [RFC] HACKING: Document 'struct' keyword usage, Thomas Huth, 2019/07/31
- Re: [Qemu-devel] When to use qemu/typedefs.h, Markus Armbruster, 2019/07/31
- Re: [Qemu-devel] When to use qemu/typedefs.h, Paolo Bonzini, 2019/07/31
- Re: [Qemu-devel] When to use qemu/typedefs.h,
Thomas Huth <=
- Re: [Qemu-devel] When to use qemu/typedefs.h, Peter Maydell, 2019/07/31
- Re: [Qemu-devel] When to use qemu/typedefs.h, Daniel P . Berrangé, 2019/07/31
- Re: [Qemu-devel] When to use qemu/typedefs.h (was: [PATCH 23/28] numa: Don't include hw/boards.h into sysemu/numa.h), Eduardo Habkost, 2019/07/30
[Qemu-devel] [PATCH 07/28] trace: Do not include qom/cpu.h into generated trace.h, Markus Armbruster, 2019/07/26
[Qemu-devel] [PATCH 08/28] Include sysemu/reset.h a lot less, Markus Armbruster, 2019/07/26
[Qemu-devel] [PATCH 15/28] Include migration/vmstate.h less, Markus Armbruster, 2019/07/26
[Qemu-devel] [PATCH 19/28] Include qemu/queue.h slightly less, Markus Armbruster, 2019/07/26