This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

the size of array must be greater than zero??

I just ran into the following error:

"main.c", line 10: error: the size of an array must be greater than zero

Since when do arrays have to have a size greater than zero?   I've always used zero-length arrays to hold variable amounts of data at the end of a 'header' structure...   For example,

struct Packet

{

int version;

...other header values...

int crc;

char data[0];

};

Then I can create my data packet by :

struct Packet  *myPacket = (struct Packet*) malloc(sizeof(struct Packet) + datalength);

...  I've done this for years, and have seen it done in a lot of very common code (like the Linux kernel).   Why does the TI DSP C compiler (TI/C6000CGT7.0.3/bin/cl6x) not support it?

 

Thanks

Rob