[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 1/7] Use proper typedef syntax
From: |
Måns Rullgård |
Subject: |
[Qemu-devel] Re: [PATCH 1/7] Use proper typedef syntax |
Date: |
Wed, 23 Sep 2009 01:24:05 +0100 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (Instant Classic, linux) |
Juan Quintela <address@hidden> writes:
> Why this ever compiled is a mistery to me.
>
> Signed-off-by: Juan Quintela <address@hidden>
> ---
> 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
address@hidden
- [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code, Juan Quintela, 2009/09/22
- [Qemu-devel] [PATCH 4/7] gcc wants 1st static and then const, Juan Quintela, 2009/09/22
- [Qemu-devel] [PATCH 2/7] static and inline should came before the type of the functions, Juan Quintela, 2009/09/22
- [Qemu-devel] [PATCH 1/7] Use proper typedef syntax, Juan Quintela, 2009/09/22
- [Qemu-devel] Re: [PATCH 1/7] Use proper typedef syntax,
Måns Rullgård <=
- [Qemu-devel] [PATCH 3/7] Bring two last users of K&R definitions to ANSI c89, Juan Quintela, 2009/09/22
- [Qemu-devel] [PATCH 5/7] __thread should be before real type, Juan Quintela, 2009/09/22
- [Qemu-devel] [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS, Juan Quintela, 2009/09/22
[Qemu-devel] [PATCH 7/7] Remove PARAMS() macro, Juan Quintela, 2009/09/22
Re: [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code, Markus Armbruster, 2009/09/23