need a good explanation

Discussion in 'C++' started by Anarki, Jun 26, 2008.

  1. Anarki

    Anarki Guest

    what are the differences between

    1) #include <iostream.h>

    2) #include <iostream>
    using namespace std;
     
    Anarki, Jun 26, 2008
    #1
    1. Advertisements

  2. Anarki

    Martin York Guest

    On Jun 25, 10:11 pm, Anarki <> wrote:
    > what are the differences between
    >
    > 1)  #include <iostream.h>

    This was valid before the STL became standard.
    After standardization it is no longer valid. Some compilers support it
    but only for backwards computability, as a result any code using this
    is not very portable.


    >
    > 2) #include <iostream>
    >     using namespace std;


    This is part of the STL.
    All items in the STL are in the std namespace.
     
    Martin York, Jun 26, 2008
    #2
    1. Advertisements

  3. Anarki wrote:
    > what are the differences between
    >
    > 1) #include <iostream.h>
    >
    > 2) #include <iostream>
    > using namespace std;


    Both are equally bad ways of saying:

    #include <iostream>
     
    Juha Nieminen, Jun 26, 2008
    #3
  4. Anarki

    kamit Guest

    As others have mentioned use #include <iostream> and NOT #include
    <iostream.h>.

    Case 1: #include <iostream>
    Here everything is wrapped under the namespace std;


    Case 2: #include <iostream.h>
    Here everything is under global namespace.

    HTH.

    On Jun 26, 6:18 am, Juha Nieminen <> wrote:
    > Anarki wrote:
    > > what are the differences between

    >
    > > 1)  #include <iostream.h>

    >
    > > 2) #include <iostream>
    > >     using namespace std;

    >
    >   Both are equally bad ways of saying:
    >
    > #include <iostream>
     
    kamit, Jun 26, 2008
    #4
  5. Anarki

    Jerry Coffin Guest

    In article <>,
    says...
    >
    > "Anarki" <> wrote in message
    > news:...
    > > what are the differences between
    > >
    > > 1) #include <iostream.h>
    > >
    > > 2) #include <iostream>
    > > using namespace std;

    >
    > The second is standard C++, the first is not.
    > None of the C++ standard headers contain ".h"
    > in their names.


    ....except the deprecated ones in part 5 of Appendix D.

    --
    Later,
    Jerry.

    The universe is a figment of its own imagination.
     
    Jerry Coffin, Jun 27, 2008
    #5
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kaladhaur Palaniappa

    Need Explanation

    Kaladhaur Palaniappa, Aug 7, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,112
    Kaladhaur Palaniappa
    Aug 7, 2003
  2. Dave
    Replies:
    4
    Views:
    564
  3. a good explanation

    , May 25, 2006, in forum: Python
    Replies:
    7
    Views:
    386
    Diez B. Roggisch
    May 26, 2006
  4. 0k-
    Replies:
    4
    Views:
    365
    Steven D'Aprano
    Jan 18, 2007
  5. Need some explanation

    , Jul 8, 2005, in forum: C Programming
    Replies:
    70
    Views:
    1,551
    Mark McIntyre
    Jul 22, 2005
  6. jacob navia

    Need an explanation

    jacob navia, Dec 25, 2006, in forum: C Programming
    Replies:
    12
    Views:
    865
    Richard Heathfield
    Dec 26, 2006
  7. Daniel Vukadinovic

    Need explanation with something

    Daniel Vukadinovic, Apr 22, 2006, in forum: C++
    Replies:
    5
    Views:
    379
    Daniel Vukadinovic
    Apr 22, 2006
  8. Dark Ambient
    Replies:
    2
    Views:
    133
    Jim Cochrane
    Jul 22, 2006
Loading...