This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Compiler Research

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?

Parents
  • 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.

Reply
  • 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.

Children
No data