This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [cxx-conversion] Convert vec.[ch] to C++ [1/3] (issue6233044)


On 12-05-25 14:27 , Tom Tromey wrote:
"Diego" == Diego Novillo<dnovillo@google.com> writes:

Diego> +struct GTY(()) vec_prefix Diego> +{ Diego> + unsigned num; Diego> + unsigned alloc; Diego> +}; Diego> + Diego> +/* Vector type, user visible. */ Diego> +template<typename T> Diego> +struct GTY(()) vec_t Diego> +{ Diego> + vec_prefix prefix; Diego> + T GTY((length ("%h.prefix.num"))) vec[1]; Diego> +};

I'm curious why you didn't use inheritance here.

     template<typename T>
     struct GTY(()) vec_t : public vec_prefix
     {
     ...
     };

Minimalism. I was almost obsessed by it with the first patch. It would've required more changes if I didn't make it a POD type.


I will make it into a more standard C++ type in subsequent patches.


Diego.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]