[Top][All Lists]

[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: Jamie Lokier
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 18:04:02 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

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 ;-)

-- Jamie

reply via email to

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