|
-
October 2nd, 2008, 04:53 PM
#1
sizeof(static array[])
hi, I have a static array, as a static class member whichz definition looks a bit like:
Code:
//.h
class A
{
public:
static struct _Foo { int x, y, z; } Foo[];
};
.cpp
A::_Foo A::Foo[] =
{
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
};
when I ask the compiler for the sizeof(A::Foo) it says its an invalid use of the sizeof directive, this seems a bit strange to me, when you initialize Foo, there will only be a fixed amount of _Foo structs in the array, so why can't the compiler give me this value?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|