|
| | Subject: | const issues | | Group: | Gcc-help | | From: | Jason Pepas | | Date: | 29 Feb 2008 |
this compiles as expected:
#include <stdlib.h>
int main()
{
const int a = 42;
const int * const b = &a;
const int * const c = b;
return EXIT_SUCCESS;
}
but moving the variables outside of the function causes gcc to die
with "error: initializer element is not constant" on line 5 (the "c =
b" line):
#include <stdlib.h>
const int a = 42;
const int * const b = &a;
const int * const c = b;
int main()
{
return EXIT_SUCCESS;
}
As best as I can tell, the error is a lie: I can't make that any more
const than it already is.
ideas?
-jason pepas
|