Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqFex-00008K-1w for qemu-devel@nongnu.org; Tue, 22 Sep 2009 20:24:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqFeq-00007q-Il for qemu-devel@nongnu.org; Tue, 22 Sep 2009 20:24:36 -0400 Received: from [199.232.76.173] (port=49413 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqFeq-00007k-3f for qemu-devel@nongnu.org; Tue, 22 Sep 2009 20:24:32 -0400 Received: from lo.gmane.org ([80.91.229.12]:44363) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MqFep-00078d-2T for qemu-devel@nongnu.org; Tue, 22 Sep 2009 20:24:31 -0400 Received: from list by lo.gmane.org with local (Exim 4.50) id 1MqFem-0005uq-CA for qemu-devel@nongnu.org; Wed, 23 Sep 2009 02:24:28 +0200 Received: from unicorn.mansr.com ([78.86.181.103]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Sep 2009 02:24:28 +0200 Received: from mans by unicorn.mansr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Sep 2009 02:24:28 +0200 From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= Date: Wed, 23 Sep 2009 01:24:05 +0100 Message-ID: References: <4880a0bea524cc86c079cf356172d0599636f358.1253661009.git.quintela@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: news Subject: [Qemu-devel] Re: [PATCH 1/7] Use proper typedef syntax List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Juan Quintela writes: > Why this ever compiled is a mistery to me. > > Signed-off-by: Juan Quintela > --- > hw/serial.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/serial.c b/hw/serial.c > index a22770f..6e8c6e1 100644 > --- a/hw/serial.c > +++ b/hw/serial.c > @@ -98,13 +98,13 @@ > #define RECV_FIFO 1 > #define MAX_XMIT_RETRY 4 > > -struct SerialFIFO { > +typedef struct SerialFIFO { > uint8_t data[UART_FIFO_LENGTH]; > uint8_t count; > uint8_t itl; /* Interrupt Trigger Level */ > uint8_t tail; > uint8_t head; > -} typedef SerialFIFO; > +} SerialFIFO; Syntactically, typedef is a storage class specifier just like static or extern, and the entire struct { } block is type specifier like int or float. The order of type specifiers and storage class specifiers is not important. The above construct is thus perfectly valid, albeit unusual, C code. That said, I'm all in favour of changing it to the more common style. -- Måns Rullgård mans@mansr.com