Thread: don't use .h?

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    2

    don't use .h?

    I've had people tell me to not to include the .h in lines like #include <iostream.h> unless it's a custom header. How widespread of a convention is this?

    Thanks,
    farruinn

  2. #2
    The Pantless Man CheesyMoo's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Well really it depends on the compiler if you do that, but most people use it that way along with using namespace std;
    So:
    Code:
    #include <iostream> // Standard header
    #include "specailbrownies.h" // Custom Header
    using namespace std;
    If you ever need a hug, just ask.

  3. #3
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    On almost all the compilers I have used you can use either.

    I recomend the .h method just because I am a linux fan and am a C veteran
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    "How widespread of a convention is this?"

    It's my understanding that it's in the C++ standard, so that means it's a very widespread convention.

    Also, some people have told me that

    using namespace std;

    is bad form. Instead they advocate doing it like this:

    using std::cout;
    using std::cin;

    (I use the first method.)
    Last edited by 7stud; 04-06-2003 at 01:12 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. .h files: "constant already defined"
    By wakeup in forum C++ Programming
    Replies: 11
    Last Post: 11-22-2005, 05:31 AM
  2. .h file help
    By Rune Hunter in forum C++ Programming
    Replies: 3
    Last Post: 02-06-2005, 02:49 PM
  3. Difference between .h and .c files
    By Metalix in forum C Programming
    Replies: 9
    Last Post: 01-19-2005, 08:38 PM
  4. placement of (.h) and (.cpp) files..!?
    By matheo917 in forum C++ Programming
    Replies: 3
    Last Post: 02-22-2003, 06:37 PM
  5. including an .h file
    By Smiley0101 in forum C++ Programming
    Replies: 3
    Last Post: 02-08-2003, 12:22 PM