qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Coding style, C++ compatible code (was Re: [Qemu-devel]


From: malc
Subject: Re: [Qemu-devel] Coding style, C++ compatible code (was Re: [Qemu-devel] [PATCH 02/22] eepro100: cast a void * makes no sense)
Date: Wed, 26 Aug 2009 22:37:01 +0400 (MSD)

On Wed, 26 Aug 2009, Jamie Lokier wrote:

> Gerd Hoffmann wrote:
> >   Hi,
> > 
> > >Why don't we declare structures like this: typedef struct { ... } T;?
> > >I suggest this to be the new coding style for structure declarations
> > >because it is shorter, C++ compatible and unambiguous.
> > 
> > There are quite a few cases where this will simply not work.  They 
> > usually use a slightly different declaration style though:
> ..
> > (1) structs pointing to each other, like this:
> > 
> > typedef struct A A;
> > typedef struct B B;
> 
> You can use "typedef struct _A A" to be C++ compatible, but it fails
> to be shorter so I wouldn't recommend it ;-)

This is neither C nor C++ compatible, in fact it breaks both.

-- 
mailto:address@hidden




reply via email to

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