qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC] [PATCHv10 08/31] aio / timers: Split QEMUClock in


From: Alex Bligh
Subject: Re: [Qemu-devel] [RFC] [PATCHv10 08/31] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList
Date: Mon, 12 Aug 2013 18:25:46 +0100

On 12 Aug 2013, at 18:04, Richard Henderson wrote:

> On 08/12/2013 09:25 AM, Alex Bligh wrote:
>> You mean one can't do
>> 
>> typedef struct foo foo;
>> ...
>> typedef struct foo {
>>  ...
>> } foo;
>> 
>> ?
> 
> No, but you can do
> 
> typedef struct foo foo;
> ...
> struct foo {
> };
> 
> It's the double typedef that's the problem.

Yup I realise that - I just didn't know that was an error.

The problem is that include file A which has
the struct definition in doesn't know whether include
file B which has the definition in has been included
or not.

So if file B has

typedef struct foo foo;

and file A defines struct foo, then
a) if A uses typedef, this will fail if bar.c includes
   B then A
b) if A does not use typedef, this will fail if baz.c
   does not include B then A.

The only reasonable solution would appear to be to
move all the typedefs to typedefs.h and ensure that
is included by .h file. Yuck. And only ever typedef
in one include file.

-- 
Alex Bligh







reply via email to

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