|
From: Per W. <pw...@ia...> - 2006-02-13 00:20:50
|
It is only the new include files that have their symbols in the std::
namespace. With the older include files, no std:: is needed, since there
was no namespace keyword in the original C++ standard.
/Per W
On Sun, 12 Feb 2006, lordSauron wrote:
> On 2/11/06, Per Westermark <pw...@ia...> wrote:
> > You could use the iostream.h. Note that the cited message was a warning,
> > not an error, and it explicitly said that the header you used was
> > deprecated, i.e. not recommended for use anymore.
>
> I just take that as a "don't use it - it's going to disappear soon!"
>
> There was nothing *wrong* with your original code, save for the
> #include -s and the lack of a using namespace std; Without namespace
> std; - correct me if I'm wrong - you'd need to do iostream::cout
> instead of a shorter cout call.
>
> So, you could forgo the using namespace std;, however, you would need
> to use iostream::cout and iostream::cin whenever trying to use
> something found in the iostream include.
>
> Also, to use system("pause"); you would need to include cstdlib (or
> cstdlib.h, take your pick). If you didn't use using namespace std;
> you would also need to use cstdlib::system("pause"); to make that
> system call. Also note that system("pause"); is only valid on MS DOS
> machines, since the pause command is not found in other shells like
> bash.
>
> That's my $0.02.
>
> > The file conio.h on the other hand is a non-standard file, i.e. a file
> > that have only existed on some platforms (normally old MS-DOS compilers).
> > Since most compilers does not have this file, it shouldn't - and in most
> > cases can't - be used.
> >
> > /Per W
> >
> > On Fri, 10 Feb 2006, Titi Anggono wrote:
> >
> > > Hi all,
> > >
> > > I just tried dev-cpp 4.9.9.2 today and began with
> > > ----------------
> > > #include <iostream.h>
> > > #include <conio.h>
> > > main()
> > > {
> > > cout <<"Hello word";
> > > getch();
> > > }
> > > -----------------
> > > the code wasn't compiled and I got following message "
> > > #warning This file includes at least one deprecated or
> > > antiquated header. Please consider using one of the 32
> > > headers found in section 17.4.1.2 of the c++ standard.
> > > ..."
> > >
> > > But, when I used stdio.h and replaced cout with printf
> > > the code compiled and the result shown.
> > > Can someone explaine why I couldn't use iostream
> > > header ?
> > >
> > > Thanks
> > > Titi
|