From: Ralph T. <ra...@gm...> - 2005-03-23 08:49:57
|
I just checked a small change into algorithm.hpp in the sandbox fixing a warning which appeared for most files in ASL. Was there any reason why swap was ambigous before (i.e.: does this break builds on other compilers)? Thanks, Ralph Index: adobe-source/adobe/algorithm.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/algorithm.hpp,v retrieving revision 1.1 diff -u -r1.1 algorithm.hpp --- adobe-source/adobe/algorithm.hpp 19 Mar 2005 00:16:38 -0000 1.1 +++ adobe-source/adobe/algorithm.hpp 23 Mar 2005 08:43:02 -0000 @@ -41,8 +41,7 @@ template <typename T> inline void do_swap(T& a, T& b) { - using namespace std; - swap(a, b); + std::swap(a, b); } |
From: Ralph T. <ra...@gm...> - 2005-03-23 10:20:01
|
Okay, now I understand why it was the way it was (and have backed out my change). My apologies for not better examining the change. I now think (although I should probably postpone further thinking 'til the morning..) that a better change would be in istream.hpp. Please let me know if this is acceptable or not: Index: adobe-source/adobe/istream.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/istream.hpp,v retrieving revision 1.1 diff -u -r1.1 istream.hpp --- adobe-source/adobe/istream.hpp 19 Mar 2005 00:16:38 -0000 1.1 +++ adobe-source/adobe/istream.hpp 23 Mar 2005 10:15:49 -0000 @@ -67,7 +67,7 @@ stream_error_t(stream_error_t& base, const line_position_t& position) : std::logic_error(base.what()) { - adobe::swap(line_position_set_m, base.line_position_set_m); + std::swap(line_position_set_m, base.line_position_set_m); line_position_set_m.push_back(position); } This is the warning I get: Compiler is Microsoft Visual C++ ...patience... ...found 1176 targets... ...updating 21 targets... C++ external\adobe\source\adam.obj adam.cpp external\adobe\algorithm.hpp(45) : warning C4675: 'void std::swap<adobe::line_po sition_t,std::allocator<_Ty>>(std::vector<_Ty> &,std::vector<_Ty> &)' : resolved overload was found by argument-dependent lookup with [ _Ty=adobe::line_position_t ] F:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\vector(94 4) : see declaration of 'std::swap' external\adobe\algorithm.hpp(129) : see reference to function template i nstantiation 'void adobe::implementation::do_swap<T>(T &,T &)' being compiled with [ T=adobe::stream_error_t::position_set_t ] external\adobe\istream.hpp(70) : see reference to function template inst antiation 'void adobe::fn::swap<adobe::stream_error_t::position_set_t>(T &,T &)' being compiled with [ T=adobe::stream_error_t::position_set_t ] ...interrupted Terminate batch job (Y/N)? y On Wed, 23 Mar 2005 00:49:39 -0800, Ralph Thomas <ra...@gm...> wrote: > I just checked a small change into algorithm.hpp in the sandbox fixing > a warning which appeared for most files in ASL. > > Was there any reason why swap was ambiguous before (i.e.: does this > break builds on other compilers)? > > Thanks, > Ralph > > Index: adobe-source/adobe/algorithm.hpp > =================================================================== > RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/algorithm.hpp,v > retrieving revision 1.1 > diff -u -r1.1 algorithm.hpp > --- adobe-source/adobe/algorithm.hpp 19 Mar 2005 00:16:38 -0000 1.1 > +++ adobe-source/adobe/algorithm.hpp 23 Mar 2005 08:43:02 -0000 > @@ -41,8 +41,7 @@ > template <typename T> > inline void do_swap(T& a, T& b) > { > - using namespace std; > - swap(a, b); > + std::swap(a, b); > } > |
From: Sean P. <sp...@ad...> - 2005-03-23 15:06:34
|
The warnings are that ADL was used to resolve the function - however, the reason why we have adobe::swap() is that this is the one function (other than the operators) where ADL is desirable. The correct fix here would simply be to use a pragma to silence the warning inside do_swap(). We don't want to change to call with std::swap because then if we add on overload of swap for line_position_t (there may already be one... I'm not looking at the source right now) then we will miss it. Sean On Mar 23, 2005, at 2:19 AM, Ralph Thomas wrote: > Okay, now I understand why it was the way it was (and have backed out > my change). My apologies for not better examining the change. > > I now think (although I should probably postpone further thinking 'til > the morning..) that a better change would be in istream.hpp. Please > let me know if this is acceptable or not: > > Index: adobe-source/adobe/istream.hpp > =================================================================== > RCS file: > /cvsroot/adobe-source/sandbox/adobe-source/adobe/istream.hpp,v > retrieving revision 1.1 > diff -u -r1.1 istream.hpp > --- adobe-source/adobe/istream.hpp 19 Mar 2005 00:16:38 -0000 1.1 > +++ adobe-source/adobe/istream.hpp 23 Mar 2005 10:15:49 -0000 > @@ -67,7 +67,7 @@ > stream_error_t(stream_error_t& base, const line_position_t& > position) : > std::logic_error(base.what()) > { > - adobe::swap(line_position_set_m, base.line_position_set_m); > + std::swap(line_position_set_m, base.line_position_set_m); > line_position_set_m.push_back(position); > } > > > This is the warning I get: > > > Compiler is Microsoft Visual C++ > ...patience... > ...found 1176 targets... > ...updating 21 targets... > C++ external\adobe\source\adam.obj > adam.cpp > external\adobe\algorithm.hpp(45) : warning C4675: 'void > std::swap<adobe::line_po > sition_t,std::allocator<_Ty>>(std::vector<_Ty> &,std::vector<_Ty> &)' > : resolved > overload was found by argument-dependent lookup > with > [ > _Ty=adobe::line_position_t > ] > F:\Program Files\Microsoft Visual Studio .NET > 2003\Vc7\include\vector(94 > 4) : see declaration of 'std::swap' > external\adobe\algorithm.hpp(129) : see reference to function > template i > nstantiation 'void adobe::implementation::do_swap<T>(T &,T &)' being > compiled > with > [ > T=adobe::stream_error_t::position_set_t > ] > external\adobe\istream.hpp(70) : see reference to function > template inst > antiation 'void > adobe::fn::swap<adobe::stream_error_t::position_set_t>(T &,T &)' > being compiled > with > [ > T=adobe::stream_error_t::position_set_t > ] > ...interrupted > Terminate batch job (Y/N)? y > > > On Wed, 23 Mar 2005 00:49:39 -0800, Ralph Thomas <ra...@gm...> > wrote: >> I just checked a small change into algorithm.hpp in the sandbox fixing >> a warning which appeared for most files in ASL. >> >> Was there any reason why swap was ambiguous before (i.e.: does this >> break builds on other compilers)? >> >> Thanks, >> Ralph >> >> Index: adobe-source/adobe/algorithm.hpp >> =================================================================== >> RCS file: >> /cvsroot/adobe-source/sandbox/adobe-source/adobe/algorithm.hpp,v >> retrieving revision 1.1 >> diff -u -r1.1 algorithm.hpp >> --- adobe-source/adobe/algorithm.hpp 19 Mar 2005 00:16:38 -0000 >> 1.1 >> +++ adobe-source/adobe/algorithm.hpp 23 Mar 2005 08:43:02 -0000 >> @@ -41,8 +41,7 @@ >> template <typename T> >> inline void do_swap(T& a, T& b) >> { >> - using namespace std; >> - swap(a, b); >> + std::swap(a, b); >> } >> > > > ------------------------------------------------------- > This SF.net email is sponsored by: 2005 Windows Mobile Application > Contest > Submit applications for Windows Mobile(tm)-based Pocket PCs or > Smartphones > for the chance to win $25,000 and application distribution. Enter > today at > http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click > _______________________________________________ > Adobe-source-devel mailing list > Ado...@li... > https://lists.sourceforge.net/lists/listinfo/adobe-source-devel |