Not sue if this is the right place to report this problem.

The following doesn't compile for me. 

-------------------------snip---------------------------
#include <stdio.h>

const int const1 = 10;
const int const2 = 11;

int arr[] = {
    const1,
    const2
}; 

int main(void)
{
        printf("consts %d %d \n", arr[0], arr[1]);
}
-------------------------snip---------------------------

$ gcc main.c 
main2.c:7: error: initializer element is not constant
main2.c:7: error: (near initialization for ‘arr[0]’)
main2.c:9: error: initializer element is not constant
main2.c:9: error: (near initialization for ‘arr[1]’)


Where as the following works!

-------------------------snip---------------------------
#include <stdio.h>

const int const1 = 10;
const int const2 = 11;

int main(void)
{
        int arr[] = {
            const1,
            const2
        }; 

        printf("consts %d %d \n", arr[0], arr[1]);
}

-------------------------snip---------------------------

ARM RVCT compiler compiles both without any errors.

best regards,
Aneesh

Reply via email to