> Can I ask for specific reasons why people prefer explicit? Any potential > danger for not being explicit?
Hello Zhongyi, It is hard to show in a toy example; in fact "using namespace" is best for code examples where you want to get an idea across and not cloud it with too much other code. But see the below example, and imagine the "//..." bits are dozens of lines. When you see f(x) you don't know which function will be called. You have to stop and search up to find the currently active namespace definition. The bigger your project, and the more 3rd party libraries you deal with, the more this slows you down. See also: http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.5 Darren //------------------------------------------ #include <iostream> namespace xx{ double f(double x){ return x*x; } } namespace yy{ double f(double y){ return y+y; } } void one(double x){ using namespace xx; //.... std::cout<<f(x)<<"\n"; } void two(double x){ using namespace yy; //.... std::cout<<f(x)<<"\n"; } int main (int,char**){ const double PI=3.14; one(PI); two(PI); std::cout<<xx::f(PI)<<"\n"; std::cout<<yy::f(PI)<<"\n"; return 0; } -- Darren Cook, Software Researcher/Developer http://dcook.org/work/ (About me and my work) http://dcook.org/blogs.html (My blogs and articles) _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel