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

Format "({" is reported as error

Hi experts,

i am trying to define a macro in the format

#define SUM(x,y) ({log_var = x; log_var += y;})

void main(void)

{

    unsigned int log_var;

    SUM(10,20);

}

Compilation of the same by ARMCC throws an error "Expected an expression" but compilation with GCC doesn't throw the error.

Is it the syntax "({<statements>});" is not allowed in ARMCC or is there any other reason for the same ?

The same disappears when the parentheses is removed. i.e "{<statements>}"

Message was edited by: techguyz

0