Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » what technique does U++ use to reduce code bloat from too many template instantiations?
Re: what technique does U++ use to reduce code bloat from too many template instantiations? [message #5204 is a reply to message #410] Sun, 10 September 2006 18:32 Go to previous messageGo to previous message
thierry is currently offline  thierry
Messages: 9
Registered: September 2006
Promising Member
Could it possible that theIDE can help still a little with encouraging the following practice in case of not so clever linker (relying only on weakreferences) that anyway can't avoid the inline code bloat:

T.h : no inline code for templates
(well just recommand and do it)

T.tpp: template function implementation

T_mytype.cpp: one for each explicit instanciation
#include "T.tpp"
template T<mytype>;

This is really annoying for a programmer to create one cpp per instanciation, but this is where an ide can help a lot to save developer to follow this guideline with generating the T_mytype.cpp for him, with maybe having a repository of all instanciations at least by packages... Then the linker shall be only smart enough not to link twice the same code.

This would not only save code bloat, but also compilation time, so far template would be compile only once, and changes in .tpp won't affect other modules



 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Proposal: BinFindIndex should return 0 for empty container
Next Topic: Value with unsigned support
Goto Forum:
  


Current Time: Sun Apr 27 21:09:59 CEST 2025

Total time taken to generate the page: 0.01242 seconds