From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MgLv2-0000YQ-J7 for qemu-devel@nongnu.org; Wed, 26 Aug 2009 13:04:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MgLuv-0000Tm-DC for qemu-devel@nongnu.org; Wed, 26 Aug 2009 13:04:19 -0400 Received: from [199.232.76.173] (port=57460 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgLuu-0000TZ-Vb for qemu-devel@nongnu.org; Wed, 26 Aug 2009 13:04:13 -0400 Received: from mail2.shareable.org ([80.68.89.115]:43471) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MgLuu-00007p-6e for qemu-devel@nongnu.org; Wed, 26 Aug 2009 13:04:12 -0400 Date: Wed, 26 Aug 2009 18:04:02 +0100 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) Message-ID: <20090826170402.GA25726@shareable.org> References: <51486eb6860d1680c1bce45e310dcd3aae096f43.1251111439.git.quintela@redhat.com> <4A928DF0.9000106@weilnetz.de> <87tyzxnwvb.fsf@pike.pond.sub.org> <4A953E20.8080806@mail.berlios.de> <4A954B61.4010708@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A954B61.4010708@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Anthony Liguori , Markus Armbruster , qemu-devel@nongnu.org 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