【发布时间】:2012-12-30 09:46:16
【问题描述】:
我对 SDCC 有疑问。我的代码(我试图从另一个编译器移植)使用具有灵活数组成员的结构。但是,当我尝试编译以下代码时:
/** header of string list */
typedef struct {
int nCount;
int nMemUsed;
int nMemAvail;
} STRLIST_HEADER;
/** string list entry data type */
typedef struct {
int nLen;
char str[];
} STRLIST_ENTRY;
/** string list data type */
typedef struct {
STRLIST_HEADER header;
STRLIST_ENTRY entry[];
} STRLIST; // By the way, this is the line the error refers to.
int main()
{
return 0;
}
SDCC 给出以下错误:
$ sdcc -mz80 -S --std-c99 test.c
test.c:18: warning 186: invalid use of structure with flexible array member
test.c:18: error 200: field 'entry' has incomplete type
什么给了?这段代码在 gcc 中编译得很好,更不用说我正在使用的其他 z80 编译器了。
编辑:我发现this SDCC bug 似乎是相关的。有人可以解释一下是不是以及如何?
【问题讨论】:
标签: c compiler-construction z80 sdcc