This is the mail archive of the gcc@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: gengtype needs for C++?


On Tue, 2010-06-29 at 11:40 +0200, Paolo Bonzini wrote:
> On 06/29/2010 04:16 AM, Tom Tromey wrote:
> > Ian>  In Tom's interesting idea, we would write the mark function by hand for
> > Ian>  each C++ type that we use GTY with.
> >
> > I think we should be clear that the need to write a mark function for a
> > new type is a drawback of this approach.  Perhaps gengtype could still
> > write the functions for ordinary types in GCC, just not (templatized)
> > containers.
> 
> Yes, gengtype would emit template specializations instead of its own 
> mangled function names, and it would just call the same function (e.g. 
> gt_mark) instead of using mangled names.  The C++ front-end would pick 
> up the correct function.

It seems very complicated to me (and apparently different from current
gengtype behavior), and I don't understand why should gengtype emit
template specializations instead of simple code. Of course, I am only
thinking of gengtype generated routines. 

Or probably I did not understood what you mean. Could you give a simple
example please?

> 
> For templated containers it would be the same, except that you'd have 
> overloading instead of full specialization, such as template<typename T> 
> mark(std::vector<typename T> v).  gengtype logic can be simplified a 
> lot, if we accept that some of the error reporting will be deferred to 
> the compiler.

Again, I don't understand very well. Why do C++ templates simplify
gengtype's work?

Cheers.



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