This is the mail archive of the gcc-bugs@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]

Re: [might be a bug] Solaris vs Linux template handling


On Apr 29, 1999, Lavoie Philippe <lavoie@yoho.genie.uottawa.ca> wrote:

> But how can I create a library then ? 

Libraries of templates should provide the source code, so that the
user can use specializations for his own types.  If you really want a
`closed' template library, you'll really have to explicitly
instantiate all the symbols the user might need.

> template <> void f<float>();

This is an explicit specialization, but not an explicit instantiation.
It shouldn't cause a non-weak symbol to be defined.  But if you omit
the angle brackets, it becomes an explicit instantiation, and then at
most one translation unit must include that piece of code.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists



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