------- Comment #4 from mayor1 at uralweb dot ru 2008-12-16 11:34 ------- Subject: Re: namespace, <iostream>, <cstring>
On 15 Dec 2008 17:40:49 -0000 "jakub at gcc dot gnu dot org" <gcc-bugzi...@gcc.gnu.org> wrote: > > > ------- Comment #1 from jakub at gcc dot gnu dot org > 2008-12-15 17:40 ------- > Why is that considered a bug? > If you want strlen etc. in std:: namespace, you need to >include <cstring>. if junior coder include standart c++ header he must not know about all functions declaration in this header and all subheader - therefore them injected in std namespace if he write using namespace std; - its his own problem but if he write: #include <cA> using std:: ... ; int f1() { ... } f1(); and f1() calls instead of user defined f1(), f1() from header cC that was included by cB that was included by cA - its too dificult to find and debug check it out: #include <iostream> using std::cout; using std::endl; int strcat(const char* a,const char* b){ cout<<"you never see it in g++ 4.1.2" cout<<a<<b<<endl; return 1; } int main(){ char a[]="aaaaaa"; char b[]="bbbb"; cout<<strcat(a,b)<<endl; // by overloading call // strlen included by iostream return 1; // and may be crash before it } > -- > > jakub at gcc dot gnu dot org changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|UNCONFIRMED |WAITING > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38531 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. http://uralweb.ru - äîáàâü â èçáðàííîå! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38531