Hi,

2010/7/13 Basile Starynkevitch <bas...@starynkevitch.net>:
>  The type machinery then provides allocators that take a parameter indicating 
> an exact size of object being allocated (like malloc does)
>
> and the exemple should better be
>
>
>  Then the objects of struct sorted_fields_type are allocated in GC memory as 
> follows, assuming n is the number of elements:
>
>         field_vec = ggc_alloc_sorted_fields_type (sizeof(sorted_fields_type) 
> + (n-1) * sizeof(tree));

I agree that these two changes would be an improvement.

> By the way, I would very much like that GCC code would assume that 
> variable-sized struct-ures are permitted, and declare instead
>        struct GTY((variable_size)) sorted_fields_type {
>                    int len;
>                    tree GTY((length ("%h.len"))) elts[];
>                };
>
> Perhaps such a transition is needed, or at least very useful, even before any 
> transition to C++ ?

Flexible array member is a C99 feature, IIRC GCC sources require C90.

Cheers,
-- 
Laurynas

Reply via email to