RE: [Dev-C++] Help me with debugging pls.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-08-05 12:35:16
|
> -----Original Message----- > From: Ramana Kumar [mailto:ra...@my...] > Sent: Monday, August 05, 2002 2:30 PM > To: Ioannis Vranos; C++ > Subject: RE: [Dev-C++] Help me with debugging pls. > > > Just one comment, Ioannis, writing the following: > > using namespace std; > > completely defeats the purpose of namespaces, as it just > includes everything > within the std namespace, including those things that are not needed. > Instead, I suggest writing: > > using std::cout; > using std::system; > //etc > > at the top of whichever file needs these functions. :) Well the using std::thing is elegant when used for only 2-3 names. Here indeed we could do that since we use only cout, endl, and getchar(). The using namespace std; is an attempt to defeat the namespace system when we use it in global scope (as many folks do) and i think everyone can realise that. Well i am using it in local scope. So in summary, use using std::thing when there are only 2-4 names and using namespace std; when there are more. And these, in as small scope as possible. So, the using namespace something; and using something::thing are not prohibited in local scopes. :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...]On Behalf Of Ioannis > Vranos > Sent: Thursday, 1 August 2002 7:37 PM > To: dev...@li... > Subject: RE: [Dev-C++] Help me with debugging pls. > > > I do not know the GDB thing but i have to make your code ANSI > C++ compliant. > :) > > > Ioannis > > > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Vaclav > Kremen > Sent: Wednesday, July 31, 2002 5:44 PM > To: dev...@li... > Subject: [Dev-C++] Help me with debugging pls. > > > Hello all, > here is my short code: > > #include <iostream.h> > > #include <iostream> > > #include <stdio.h> > > Or better: #include <cstdio> > > > #include <stdlib.h> > > > Or better: #include <cstdlib> > > int main (int argc, char *argv[]) > { > > int argc, char *argv[] are not used, so they are not needed. > > using namespace std; > > int x = 1000; > > x = x*x; > cout << "Hello World!" << endl; > x = 1; > cout << "Press ENTER to continue... " << x <<endl; > getchar (); > > > or better: cin.ignore(); So <cstdio> is not needed. > > > return 0; > } > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.cjb.net > * Alternative URL: http://run.to/noicys > |