This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: error: array type has incomplete element type
On Wed, 2005-02-02 at 22:12 +0900, Neil Booth wrote:
> Ralf Corsepius wrote:-
>
> > Technically, it is not obvious to me, why
> > extern struct bla array[];
> > is different from
> > extern struct bla *array;
>
> They are quite different. One's a pointer, and one isn't. In the
> former case you are telling the compiler that a pointer lives at
> location "array" and that some allocation unit allocated room for it,
> in the latter case you get a struct bla and there is no pointer
> allocated.
Thanks, just to make sure I understand correctly, I need to ask a "dummy
question":
If we want to have an "opaque declaration" (incomplete type, unspecified
size) of an array, are we now supposed to use an explicit pointer to the
array, i.e.
extern struct bla *array;
struct bla {
...
};
struct bla real_array[] = { ... };
struct bla *array = real_array;
Ralf