avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] Struct problem


From: Eric Fu
Subject: [avr-gcc-list] Struct problem
Date: Sat, 31 Jan 2004 12:05:24 +1100

Hi All,

I'm trying to declare a Structure for UART, so that it can be used for more 
than one UARTs such as:
typedef struct UART
{
 volatile byte RxHead;
 volatile byte RxTail;
 volatile byte TxHead;
 volatile byte TxTail;
 byte TxBuf[],RxBuf[]; 
}UART;
extern UART uart0;
extern UART uart1; 

By doing this way, I can assign different buffer size to different UART such as:
byte uart0.RxBuf[RX_BUFFER_SIZE0];
byte uart0.TxBuf[RX_BUFFER_SIZE0]; 
byte uart1.RxBuf[RX_BUFFER_SIZE1];
byte uart1.TxBuf[RX_BUFFER_SIZE1]; 

However, I get the following compile error:
UART.h:47: error: flexible array member not at end of struct

Could anyone give me a hint on How to tell the compiler to do this?
Thanks

Eric Fu

reply via email to

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