Subject: Re: Templates in gcc / Msvc++ 5
From: [email-masked] (James Winsor)

14 Nov 1997 10:01:04 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="------------BC20593DFE9EF55EB11C7DBB"
To: [email-masked]
Cc: [email-masked]

--------------BC20593DFE9EF55EB11C7DBB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Chad Loder wrote:

> Hello...I have been doing some messing around with partial specialization
> of template classes in C++. The cygnus gcc compiled this without errors,
> but MSVC++ 5.0 did not like it...does anyone know what the status of
> templates in the respective compilers is (e.g., egcs, new versions, etc.)?
>
> -chad
>
> template<class T>
> class common {
> public:
> };
>
> template<class T>
> class generic : public common<T> {
> public:
> };
>
> template<class T>
> class generic<T *> : public common<T*>{
> public:
> };
>

Our application is very large, and makes heavy use of templates.  It was
originallydeveloped on various UNIX platforms, and we have ported it to NT,
using Borland
5.0.1.

We have attempted to port this to VC++ (both 4.2 and 5.0) and can't get it to
compile.

One problem is in using templated classes as function arguements.  The
compiler flattens
the templated arguement, and ignores differences in the template
parameter(s).

i.e.  func(TClass<int>)  and func(TClass<float>)  resolve to func(TClass).

You end up with duplicate symbol errors.

Microsoft has essentially that this is not a critical bug for them, and don't
plan
to fix it any time soon.

(This statement came from Microsoft personnel at the Professional Developers
Conferencd
a couple of months ago.)

> ----------------------------------------------------
> | Chad Loder - Somerville, MA, USA                 |
> | EMail:     [email-masked]                        |
> | Home Page: http://www.ccs.neu.edu/home/cloder    |
> ----------------------------------------------------
>
> -
> For help on using this list (especially unsubscribing), send a message to
> "[email-masked]" with one line of text: "help".

--
Name:     Jim Winsor              |
E-Mail:   [email-masked]          |
Phone:    214-860-6420  (office)  |
          972-612-9727  (home)    |

--------------BC20593DFE9EF55EB11C7DBB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Chad Loder wrote:
<BLOCKQUOTE TYPE=CITE>Hello...I have been doing some messing around with
partial specialization
<BR>of template classes in C++. The cygnus gcc compiled this without errors,
<BR>but MSVC++ 5.0 did not like it...does anyone know what the status of
<BR>templates in the respective compilers is (e.g., egcs, new versions,
etc.)?

<P>-chad

<P>template&lt;class T>
<BR>class common {
<BR>public:
<BR>};

<P>template&lt;class T>
<BR>class generic : public common&lt;T> {
<BR>public:
<BR>};

<P>template&lt;class T>
<BR>class generic&lt;T *> : public common&lt;T*>{
<BR>public:
<BR>};
<BR>&nbsp;</BLOCKQUOTE>
Our application is very large, and makes heavy use of templates.&nbsp;
It was originallydeveloped on various UNIX platforms, and we have ported
it to NT, using Borland
<BR>5.0.1.

<P>We have attempted to port this to VC++ (both 4.2 and 5.0) and can't
get it to compile.

<P>One problem is in using templated classes as function arguements.&nbsp;
The compiler flattens
<BR>the templated arguement, and ignores differences in the template parameter(s).

<P>i.e.&nbsp; func(TClass&lt;int>)&nbsp; and func(TClass&lt;float>)&nbsp;
resolve to func(TClass).

<P>You end up with duplicate symbol errors.

<P>Microsoft has essentially that this is not a critical bug for them,
and don't plan
<BR>to fix it any time soon.

<P>(This statement came from Microsoft personnel at the Professional Developers
Conferencd
<BR>a couple of months ago.)
<BR>&nbsp;
<BLOCKQUOTE TYPE=CITE>

<P>----------------------------------------------------
<BR>| Chad Loder - Somerville, MA, USA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|
<BR>| EMail:&nbsp;&nbsp;&nbsp;&nbsp; [email-masked]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|
<BR>| Home Page: <A HREF="http://www.ccs.neu.edu/home/cloder">http://www.ccs.neu.edu/home/cloder</A>&nbsp;&nbsp;&nbsp;
|
<BR>----------------------------------------------------

<P>-
<BR>For help on using this list (especially unsubscribing), send a message
to
<BR>"[email-masked]" with one line of text: "help".</BLOCKQUOTE>
&nbsp;
<PRE>--&nbsp;
Name:&nbsp;&nbsp;&nbsp;&nbsp; Jim Winsor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;
E-Mail:&nbsp;&nbsp; [email-masked]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;
Phone:&nbsp;&nbsp;&nbsp; 214-860-6420&nbsp; (office)&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 972-612-9727&nbsp; (home)&nbsp;&nbsp;&nbsp; |</PRE>
&nbsp;</HTML>

--------------BC20593DFE9EF55EB11C7DBB--

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".