[Prev][Next][Index]
Re: gcc says "structure has no member"
Shalom,
Thanks for your mail Dalia,
Dalia Pongratz wrote:
>
> Meir,
>
> I must tell you that I completely agree with the gcc comments to your program.
Ok , my first email was somewhaqt wrong, but the 2nd message was ok.
>
> The errors at the main part are explained by the errors in the external
> structure definition.
>
> Then there is a problem in your accessing c1 by foo.c1, since c1 is a member of
> another structure inside foo. So the inner structure's tag is really missing
> there.
In fact in C what I try to do is illegal, BUT c++ allow me to decalre
an embeded struct of struct and union _omitting_ the tags only for
union. And this work fine.
>
> There's another inconsistency in your union, one of whose members is a char,
> and the other is an int.
That what union are for :=). (see: Kernighan & Ritchie p 147...)
> Regards
> Dalia
>
> --
>
Hag Shameah,
Meir