According to documentation RealView Compilation Tools Compiler User's Guide (version 3.1) Compound literals
int y[] = (int []) {1, 2, 3};
--c90 mode
warning #520-D initialization with "(...)" expected for aggregated object error #70 incomplate type is not allowed error #29 expected an expression
--c99 mode
warning #520-D initialization with "(...)" expected for aggregated object error #144 a value of type "int *" cannot be used to initialize an entity of type "int"
it must be compiled ok, but it is not. What's wrong?
Thanks it's work with --gnu compiler directive. I don't know what documentation do you read. My sources is: infocenter.arm.com/.../index.jsp http://www.keil.com/support/man/docs/armcc/armcc_BABECCFG.htm And there are no mentions about --gnu option. quote from documentation ISO C99 supports compound literals.
I don't know what documentation do you read.
I was looking in the Realview 3.1 documentation: infocenter.arm.com/.../index.html (which is marked "Superseded" because there are newer versions of the tools)
My sources is: infocenter.arm.com/.../index.jsp
That page also says "Supported in GNU mode for C only." and "Withdrawn" (in the background watermark).
Compound literals are a C99 feature, but in C99 they cannot be used to initialize arrays that way (which is reasonable since there is a similar, older way to initialize arrays). GNU allows using compound literals to initialize arrays as an extention to C99. And armcc allows the extension when in --gnu mode.