"Linda A. Walsh" <
gcc@...> writes:
> Compile time output:
> ct.c:10: error: initializer element is not constant
> ct.c:11: error: initializer element is not constant
If you compile the program as C++ rather than C, then these
errors go away, and GCC 4.3.1 propagates the constants to the
printf call:
movl $6, 8(%esp)
movl $7, 4(%esp)
movl $.LC0, (%esp)
call printf
This is one difference in the meaning of const between C and C++.
Another difference is that in C++, const variables defined
outside of functions are static by default, although one can
override that with extern. That doesn't matter in your program
because the variables were static already.