On Thu, 2002-11-07 at 20:30, Mike A. Harris wrote:
> On Thu, 7 Nov 2002, Thomas Dodd wrote:
>
> >>On Thu, 07 Nov 2002 10:12:38 -0600
> >>Thomas Dodd <[EMAIL PROTECTED]> wrote:
> >>
> >># Is that actuall in the standard? Is the default namespace no longer
> >># defined?
> >>#
> >># Time to start adding a namespace decleration to all my code..
> >>
> >>I think you can get away with it if you add this to your headers:
> >>
> >>using namespace std;
> >>
> >>
> >That was my plan :)
> >
> >>Although, I could be wrong.
> >>
> >I hope it doesn't take more.
> >
> >I don't understand why the ISO standard doesn't use std as the default
> >namespace. Why call it std if it's not the default standard namespace?
> >Imagine if the C spec changes standard in, out, and error (stdout,
> >sdtin, and stderr) to be required. So now this code:
> >
> >printf("Type your name:");
> >scanf("%s",name);
> >printf("Hello %s!\n",name);
> >
> >became
> >
> >fprintf(stdout,...);
> >fscanf(stdin,...);
> >fprintf(sdtout...);
> >
> >That's the kind of change the C++ standard is making.
>
> I'm not even remotely a C++ programmer, and even _I_ know how to
> deal with this properly.
>
> using namespace std;
>
>
>
>
> --
> Mike A. Harris ftp://people.redhat.com/mharris
> OS Systems Engineer
> XFree86 maintainer
> Red Hat Inc.
>
Hi all,
This thread seems to be getting fragmented into snippets of code and
really needs bringing together.
The originator should use 'g++' for C++.
Usable C++ file extensions are .C, .cc, .cp, .cpp, .cxx or .c++. I
personally always go with '.cpp'.
You can code the program in one of the two following ways and meet the
ANSI ISO C++ standard.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World\n";
return 0;
}
or
#include <iostream>
int main()
{
std::cout << "Hello World\n";
return 0;
}
As a sub note about the warning when including 'iostream.h' languages
change and evolve and thus with the evolution of C++ things are being
deprecated. You also get a similar warning under MSVC 7 .NET, if you
include iostream.h.
Hope this helps.
Regards
Philip Wyett
--
AIM: PhilipWyett
ICQ: 135463069
Email: [EMAIL PROTECTED]
--
Public key ID: 39018C68
Public key stored at: http://www.keyserver.net
--
signature.asc
Description: This is a digitally signed message part
