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: Final intermodule patch


Mark Mitchell <mark@codesourcery.com> writes:

| In the case of "export", the current approach would result in multiply
| defined symbols at link time because global entities present in both the
| template and main translation unit would be emitted twice -- once when
| you compiled the template, and once when you compiled the file that
| instantiated the template.

I believe Mark has a point here.  We should not just focus on
implementation techniques.  We should take interferences with
different language semantics into account, and primarily observable
behaviour and user interface.

"export", as pointed out by Mark, has semantics than heavily use the
notion of translation unit.  While in C program translation  operates
only on one translation unit at a time, C++  has a multi-scale notion
of translation:  First translation units are produced (more or less
like in C), then from translation units one get instantiation units.
And here the contexts of (template) implementations and instantiations
are key players. 

-- Gaby


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