You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Martin Sebor <se...@roguewave.com> on 2007/08/14 18:32:56 UTC

Re: svn commit: r544831 - /incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp

faridz@apache.org wrote:
> Author: faridz
> Date: Wed Jun  6 06:03:48 2007
> New Revision: 544831
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=544831
> Log:
> 2007-06-06 Farid Zaripov <Fa...@epam.com>
> 
> 	* dynatype.cpp (copy): static_cast to const T& instead of T

Why is this an improvement over the original?

If it's a workaround for a bug in some compiler (MSVC?) please
remember to a) add a comment to that effect above the expression
so that the next person to work on the code doesn't inadvertently
revert it, and b) document the same in the ChangeLog entry for
the benefit of others. Otherwise, if it's not a workaround but
rather an efficiency improvement, just say so in the ChangeLog.

Thanks!
Martin

> 
> Modified:
>     incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp
> 
> Modified: incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp
> URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp?view=diff&rev=544831&r1=544830&r2=544831
> ==============================================================================
> --- incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp (original)
> +++ incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp Wed Jun  6 06:03:48 2007
> @@ -58,7 +58,7 @@
>      // helper: copies one instance of dynatype to another
>      template <class T>
>      void copy (const dynatype &rhs) {
> -        *this = static_cast<T>(rhs);
> +        *this = static_cast<const T&>(rhs);
>      }
>  
>      // pointers to the helpers (do not depend on a template parameter)
> 
> 


RE: svn commit: r544831 - /incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp

Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com] 
> Sent: Tuesday, August 14, 2007 7:33 PM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: svn commit: r544831 - 
> /incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp
> 
> faridz@apache.org wrote:
> > Author: faridz
> > Date: Wed Jun  6 06:03:48 2007
> > New Revision: 544831
> > 
> > URL: http://svn.apache.org/viewvc?view=rev&rev=544831
> > Log:
> > 2007-06-06 Farid Zaripov <Fa...@epam.com>
> > 
> > 	* dynatype.cpp (copy): static_cast to const T& instead of T
> 
> Why is this an improvement over the original?
> If it's a workaround for a bug in some compiler (MSVC?) 
> please remember to a) add a comment to that effect above the 
> expression so that the next person to work on the code 
> doesn't inadvertently revert it, and b) document the same in 
> the ChangeLog entry for the benefit of others. Otherwise, if 
> it's not a workaround but rather an efficiency improvement, 
> just say so in the ChangeLog.

  Firstly, I thought that is the remains from my experiments to get
the example compiled on MSVC 7 and I've had time to revert this change
(http://svn.apache.org/viewvc?rev=567728&view=rev).

  But then I've remebered that It's a workaround for a bug in gcc 3.4.4.
Done thus: http://svn.apache.org/viewvc?rev=567733&view=rev

Farid.