Name: Anonymous 2009-02-04 15:43
I have some code that looks like this.
On the line declaring and initializing "d", I get the error "error: initializer element is not constant". Now, maybe I'm missing something, but aren't all of the operands there constant, therefore known at compile-time, therefore usable when initializing a constant?
typedef struct {
void *ptr;
} Foo;
static const size_t a = 1024;
static const size_t b = 1024;
static const size_t c = 1024;
static const size_t d = a * b + c * sizeof(Foo);On the line declaring and initializing "d", I get the error "error: initializer element is not constant". Now, maybe I'm missing something, but aren't all of the operands there constant, therefore known at compile-time, therefore usable when initializing a constant?