Thx a lot for the explanation, it is clear now!
On Fri, Feb 13, 2015 at 8:44 AM, Ben Pfaff <[email protected]> wrote:
> On Thu, Feb 12, 2015 at 11:02:06AM -0800, Alex Wang wrote:
> > > + struct mac_learning_port *mlport;
> >
> >
> > Simple C question, why don't we need to forward declare the struct
> > 'mac_learning_port'?
>
> Forward declarations are only necessary in one weird C corner case: when
> the first use of the struct tag is in a function parameter. So:
> void f(struct foo *);
> requires a forward declaration if this is the first use of struct foo.
> But:
> struct bar { struct foo *x; };
> or
> struct foo *f(void);
> doesn't. It's a weird rule and I wonder whether the C committee thought
> it through properly back in the late 1980s. Out of curiosity I took a
> quick look through the C standard rationale for a mention of this topic,
> but I don't see one.
>
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev