Am 26.11.2015 um 15:31 schrieb Jose Fonseca:
> Zero length arrays are non standard:
> 
>    warning C4200: nonstandard extension used : zero-sized array in 
> struct/union
>    Cannot generate copy-ctor or copy-assignment operator when UDT contains a 
> zero-sized array
> 
> And all code does `N * sizeof query_result->batch[0]`, so it should work
> exactly the same.
> ---
>  src/gallium/include/pipe/p_defines.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/include/pipe/p_defines.h 
> b/src/gallium/include/pipe/p_defines.h
> index b18eedd..cbf0ba6 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -822,8 +822,8 @@ union pipe_query_result
>     /* PIPE_QUERY_PIPELINE_STATISTICS */
>     struct pipe_query_data_pipeline_statistics pipeline_statistics;
>  
> -   /* batch queries */
> -   union pipe_numeric_type_union batch[0];
> +   /* batch queries (variable length) */
> +   union pipe_numeric_type_union batch[1];
>  };
>  
>  union pipe_color_union
> 

I guess the nice thing about using zero-sized arrays is that it makes it
really obvious that the length is variable, whereas with size one
someone might assume it's fixed. But you added the comment so I can't
see a better solution.

For the series:
Reviewed-by: Roland Scheidegger <[email protected]>
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to