freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pooma-dev] Expanding Supported Explicit Instantiations


From: Dave Nystrom
Subject: Re: [pooma-dev] Expanding Supported Explicit Instantiations
Date: Tue, 22 May 2001 13:34:54 -0600 (MDT)

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.

 > > I'm also curious whether Jim Crotinger's idea of making 'sv' private in the
 > > hope that the compiler could optimize it away was worth considering.
 > 
 > I think this is probably the right thing to do, but I defer to him or
 > you to make that change.

I would defer to Jim since he knows Pooma 2 and I really don't at this stage.

 > ****************
 > 
 > Ignoring the syntax issue, does the patch permit you to do what you
 > want?

I'll have to try it out and see.  One rationale for just instantiating "sv"
is to minimize code bloat and compile time.  The rationale for instantiating
the whole class is that I don't then have to worry about someone coming along
later and using other members of the View1 class that are not currently being
used and then forcing the compiler to do more prelinking.  It will certainly
be more preferable to me to instantiate the whole View1 class than to let the 
prelinker scatter 1800+ instantiations of View1<...>:sv over several
translation units.

Also, at some point I'd like to know more about how gcc handles template
instantiation when the user does not opt for explicit instantiation.  I'll
probably wait to explore this until I get my new laptop which will have more
disk space and will be running RedHat 7.1.

 > Thanks,
 > Jeffrey D. Oldham
 > address@hidden
 > 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]