[pooma-dev] Expanding Supported Explicit Instantiations
Jeffrey Oldham
oldham at codesourcery.com
Wed May 23 16:02:00 UTC 2001
On Tue, May 22, 2001 at 01:34:54PM -0600, Dave Nystrom wrote:
> Jeffrey Oldham writes:
> > On Tue, May 22, 2001 at 01:04:34PM -0600, Dave Nystrom wrote:
> > > Jeffrey Oldham writes:
> > > > OK to commit this patch?
> > > >
> > > > Dave Nystrom desired to explicitly instantiate this program:
> > > >
> > > > #include "Pooma/NewFields.h"
> > > >
> > > > #define T1 NoGeometry<(int)3>
> > > > #define T2 int
> > > > #define T3 CompressibleBrick
> > > > #define T4 Interval<(int)3>
> > > > template View1<Field<T1,T2,T3>,T4>::sv;
> > > >
> > > > I do not know the correct syntax for explicitly instantiating View1's
> > > > const static bool `sv' if this is even legal. The attached patch
> > > > permits instantiating
> > >
> > > I first interacted with Arch Robison at KAI about this instantiation problem
> > > and he did not comment that the syntax was wrong. Also, the KCC prelinker
> > > only instantiates the const static bool 'sv', not anything else.
> >
> > I was using gcc 3.0, not KCC. My comment about the correct syntax
> > follows from Stroustrup's Appendix C.13.10 of \emph{The C++
> > Programming Language}, Special Edition. If I remember correctly, gcc
> > 3.0 supports your original syntax, but it seems better to me to follow
> > the rules Stroustrup advises.
>
> I read through this section of Stroustrup again and I'm not sure what you are
> getting at here regarding the syntax. I would view "sv" as a member
> variable. Stroustrup specifically addresses in his 3 examples how to
> explicitly instantiate a member function. I was assuming that the
> prescription for a member variable was analagous based on his section and
> also by studying the demangled entry in the KCC .ii file. But, I'm not a
> language lawyer and I don't know if I am missing something here in the point
> you are trying to make.
According to the C++ standard, everything after "template" needs to be
a declaration. Thus, I would write
template bool View1<Field<T1,T2,T3>,T4>::sv;
Thanks,
Jeffrey D. Oldham
oldham at codesourcery.com
More information about the pooma-dev
mailing list