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.

Compiler: Array for structure syntax.

Tool/software: TI C/C++ Compiler

If I use:

const int8_t  lenBuffer=20;
struct timing
{
int32_t runNumber;
int32_t tic;
int8_t isUp;
} buffer[ lenBuffer ];

it compiles with a warning about being not standard.  If I try with a #define, it does not even compile.
What is the preferred way to do it, in CCS?  I mean, I prefer to use a defined constant, like lenTampon, instead of a magical constant like 20 here and there, in the C code.

  • The problem comes from this bit of code ...

    Michel Walsh said:
    buffer[ lenBuffer ];

    This is legal in C++.  In C, it is not legal.  But the TI compiler accepts it anyway, and issues the warning you mention.

    Michel Walsh said:
    If I try with a #define, it does not even compile.

    I cannot reproduce this result.  For the source file which has this problem code, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George



  • Case solved. I included the file that I was using and, interestingly, retyping it to resubmit it, but without the ending semi-colon at line 2, as it is the right way to do it, there is no error anymore. Just a case of a bad oversight from my part.