B
better_cs_now
Hello All,
I'd like to do this:
class Foo
{
...
static unsigned char s_data[sizeof(Foo)];
...
};
unsigned char Foo::s_data[sizeof(Foo)];
However, I cannot because at the time the first sizeof (the one in the
declaration) is encountered, Foo is an incomplete type.
I did this instead:
class Foo
{
...
static unsigned char s_data[];
...
};
unsigned char Foo::s_data[sizeof(Foo)];
The compiler accepts this. However, is it standard and does it
accomplish my intended purpose of putting enough memory for a Foo in
static storage?
Thanks,
Dave
I'd like to do this:
class Foo
{
...
static unsigned char s_data[sizeof(Foo)];
...
};
unsigned char Foo::s_data[sizeof(Foo)];
However, I cannot because at the time the first sizeof (the one in the
declaration) is encountered, Foo is an incomplete type.
I did this instead:
class Foo
{
...
static unsigned char s_data[];
...
};
unsigned char Foo::s_data[sizeof(Foo)];
The compiler accepts this. However, is it standard and does it
accomplish my intended purpose of putting enough memory for a Foo in
static storage?
Thanks,
Dave