On Tue, 24 Mar 2009, H.J. Lu wrote:

> Should
> 
> struct line {
>        int length;
>        char contents[0];
>  };
> 
> or
> 
> struct line {
>        int length;
>        char contents[];
>  };
> 
> be allowed to be passed by value? If yes, how do you access the contents 
> field?

I see nothing about passing by value different from structure assignment, 
which ignores the flexible array member (see 6.7.2.1 paragraph 22 (in 
N1256) for an example stating this).  Although argument passing and return 
aren't strictly assignments, they generally act in the same way, so such a 
structure passed by value or used as a function return value loses the 
flexible array members in the process.  I suppose an optional warning for 
this might be useful.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to