??? RE: [Dev-C++] ioannis - namespaces
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel G. <sp...@ho...> - 2002-06-28 06:55:39
|
Hasn't this just been copied from a week ago and the "thinkgeek.com" wrapper put around it? >From: "Ioannis Vranos" <no...@ho...> >To: "Dev-C++ Mailing List" <dev...@li...> >Subject: RE: [Dev-C++] ioannis - namespaces >Date: Tue, 18 Jun 2002 14:20:30 +0300 > > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Ioannis Vranos > > Sent: Tuesday, June 18, 2002 2:09 PM > > To: dev...@li... > > Subject: RE: [Dev-C++] ioannis - namespaces > > > > > > > -----Original Message----- > > > From: dev...@li... > > > [mailto:dev...@li...] On Behalf > > > Of Daniel Glenfield > > > Sent: Tuesday, June 18, 2002 1:36 PM > > > To: dev...@li... > > > Subject: [Dev-C++] ioannis - namespaces > > > > > > > > > Ioannis, you've mentioned several times to always use > > > namespaces as locally > > > as possible. I was wondering why this is? What is the benefit > > > of using them > > > locally? > > > > > > Daniel > > > > > > The namespace system was made to provide a system that > > enables combining > > various libraries while protecting from name clashes. > > > > So you can for example do: > > > > #include <iostream> > > #include <vector> > > > > > // Daniel's version of vector > > #include <daniel.h> > > > > > > int main() > > { > > using std::cout; > > using std::endl; > > > using daniel::vector; > > > > vector<int>array(50, 1); > > > > cout<<array[i]<<endl; > > } > > > > > > As god says in TC++PL, using global using directives is an efffort to > > defeat the namespace system, which has bad consequences in large > > projects. We must try to use more using std::something; than using > > namespace std; and as in small scope as possible. > > > > In general myself, i use using std::something; for 2-3 facilities in a > > given function, and if there are more i place a using > > namespace std; in > > that function scope. > > > > > > Ioannis > > > > * Ioannis Vranos > > * Programming pages: http://www.noicys.cjb.net > > * Alternative URL: http://run.to/noicys > > > > -------------------------------------------------------------- > > -------------- > > Bringing you mounds of caffeinated joy > > >>> http://thinkgeek.com/sf <<< > > > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > >---------------------------------------------------------------------------- > Bringing you mounds of caffeinated joy > >>> http://thinkgeek.com/sf <<< > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |