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: Support for export keyword to use with C++ templates ?


Timothy Madden <terminatorul@gmail.com> writes:

> Is there any progress or start yet in implemententing export for C++ templates ?

Not to my knowledge.

The C++0x standards committee considered deprecating export for C++0x,
but I think they have decided to retain it for now.


> Why is everybody such not interested in this ? It would be such a
> great feature, especially for
> a leading C++ implementation like gcc ...

Why would it be useful?  What advantage does it provide?


> Why is it so hard to store template definitions (and the set of
> symbols visible to them) in an
> object file, probably as a representation of the parsed template source tree ?

I recommend reading "Why We Can't Afford Export."  This link may work
for you:

http://docs.google.com/viewer?a=v&q=cache:lmlZ1p7te3gJ:www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1426.pdf+why+we+can't+afford+export+sutter&hl=en&gl=us&pid=bl&srcid=ADGEESgDdiuh8WxBHeWHGfnK_iJXXYj0XCWOwfnHQuja8Ihd5567rnFyRsF13uY-HN9NbjYJpwMsUo8VQNx5_ffYSiOfOMeIfKMW-d8s57IMr8B8vUN3UfpXLXVtlLd1C8UiUNNe-i7t&sig=AHIEtbQo42iDSyaR0-I4hQ1bHFV3WTeYfA

or search for the PDF.

Note in particular that namespace issues are hideously complex with
export.  Thanks to two-phase name lookup, the meaning of a template
depends on the environment in which it is defined.  That means that in
order to correctly instantiate an exported template, the export file
must contain not only the template definition, but the definition of
all names mentioned in the template definition, recursively.

As far as I know, exactly one compiler implements export, and nobody
uses it.

Ian


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