Re: [ROOT] rootcint produces invalid code for templates on Win32

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Sat Oct 13 2001 - 11:46:58 MEST


Hi Peter,

  this is the only legal syntax for explicit template specialization.
The problem is with the old VC++6. The only solution is to make a little
shell script for Windows that filters the code in a dialect acceptable
to VC++6.

Cheers, Fons.



On Friday 12 October 2001 18:52, Peter Lipa wrote:
> Hi,
> On Win32 version of rootcint (root 3.01/06 and probably also 3.02)
> the rootcint.exe produces the following code for a templated class
> NxMatrix<T>:
>
> //_________________________________________________________________________
>_ ____
> template <> TBuffer &operator>><short >(TBuffer &buf, NxMatrix<short>
> *&obj) {
>    // Read a pointer to an object of class NxMatrix<short>.
>
>    obj = (NxMatrix<short> *) buf.ReadObject(NxMatrix<short>::Class());
>    return buf;
> }
>
> //_________________________________________________________________________
>_ ____
> template <> TBuffer &operator>><unsigned short >(TBuffer &buf,
> NxMatrix<unsigned short> *&obj)
> {
>    // Read a pointer to an object of class NxMatrix<unsigned short>.
>
>    obj = (NxMatrix<unsigned short> *) buf.ReadObject(NxMatrix<unsigned
> short>::Class());
>    return buf;
> }
>
> //_________________________________________________________________________
>_ ____
> template <> TBuffer &operator>><int >(TBuffer &buf, NxMatrix<int> *&obj)
> {
>    // Read a pointer to an object of class NxMatrix<int>.
>
>    obj = (NxMatrix<int> *) buf.ReadObject(NxMatrix<int>::Class());
>    return buf;
> }
>
> etc. etc.
>
> We have to remove BY HAND the tokens "template <>" before each TBuffer&
> operator>> and the substituted <T> after the >> to make the code valid for
> MSVC++6.
>
> I don't know if this happens only in the windows version but I suspect so!
>
> Could you fix this soon, since the hand-editing step after each compile
> becomes
> very cumbersome when you have many template instantiations (as we do)?
>
> Thanks
>
> Peter
>
>
>
> ***************************************************************************
>* Peter Lipa, PhD                            e-mail: lipa@nsma.arizona.edu
> Arizona Research Labs - Neural Systems, Memory and Aging
> University of Arizona
> Life Sciences North Bldg, Room 384;   Phone: (520) 626-3101
> Tucson, AZ 85724-515                       Fax: (520) 626-2618
> ***************************************************************************
>*

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:02 MET