This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [cxx-conversion] Convert vec.[ch] to C++ [1/3] (issue6233044)
- From: Tom Tromey <tromey at redhat dot com>
- To: dnovillo at google dot com (Diego Novillo)
- Cc: reply at codereview dot appspotmail dot com, crowl at google dot com, iant at google dot com, gcc-patches at gcc dot gnu dot org
- Date: Fri, 25 May 2012 12:27:25 -0600
- Subject: Re: [cxx-conversion] Convert vec.[ch] to C++ [1/3] (issue6233044)
- References: <20120523194842.6D6291020B8@torture.tor.corp.google.com>
>>>>> "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
{
...
};
Tom