"old style" header files

This is a discussion on "old style" header files within the C++ Programming forums, part of the General Programming Boards category; hey, hope y'all are having a fine evening so i'm reading my new book (deitel&deitel--much better than the idiot's guide, ...

  1. #1
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266

    "old style" header files

    hey, hope y'all are having a fine evening so i'm reading my new book (deitel&deitel--much better than the idiot's guide, btw) and it talks about the standard library header files. what happened to the .h's. what's the difference, ad/disadvantages?

    to use them you just do
    Code:
     #include namespace std
    right? nothing else different?

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    The main difference is that the standard files use the std namespace while the old ones dont so they pollute the global namespace of your app which can cause naming conflicts. And to use them you just include the header you want not namespace std; To use them you include the header then do any of the methods of using things from a namespace ex:

    Code:
    #include<iostream>
    #include<string>
    
    using std::cin;
    using std::cout;
    using std::endl;
    using std::string;
    
    // Or you could include it all doing: 
    using namespace std;
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Confusion on header and source files
    By dnguyen1022 in forum C++ Programming
    Replies: 4
    Last Post: 01-17-2009, 02:42 AM
  3. #include header files or .cpp files?
    By DoctorX in forum C++ Programming
    Replies: 3
    Last Post: 12-23-2006, 11:21 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21