On Wed, May 16, 2012 at 2:43 PM, Diego Novillo <dnovi...@google.com> wrote: > On 12-05-16 05:41 , Richard Guenther wrote: > >> What's the reason for templating these functions? They all take trees as >> parameter!? > > > True. I don't recall what Lawrence had in mind, but I remember that by > using templates here, you don't need to deal with the mess of distinguishing > tree from const_tree, and having to force constness out with ugly casts.
Well, but you get no typesafety for it in return. You can simply provide a const_tree overload. With using templates you are also forced to retain these functions in the header file - another thing that I suppose you guys were about to "fix"? It's after all debugging code. > Additionally, templates are producing slightly smaller code than the > non-template variant (about 0.2% smaller). I'm not actually sure why this > happens, but it's consistent across all binaries. Well, what did you compare? Make sure to not have -fkeep-inline-functions, otherwise you get all bodies as compared to only the instantiated bodies. Richard. > > Diego.