Thread: header files usage

  1. #1
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459

    header files usage

    1.) is it considered 'okay' to have #include directives elsewhere but at the start of your source file?

    2.) is there a technical difference between headers and source files? what is the word for 'c/cpp' files [as you can see i've just called them 'source' for lack of better word]?

    3.) is there a such thing as 'hpp'? i would have figured so, and have used that naming convention [describing my headers as being of ++ code]

    thank you
    hasafraggin shizigishin oppashigger...

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    1) NONONO

    2) Yes.... although I don't really know what it is. It has something to do with object files being produced soley by the .cpp file... headers are only important at compile time, while source files are important at the link stage, I believe.

    3) hpp is a header for c++.. to differentiate them from C++ headers with .h extension, which are not valid C headers.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  3. #3
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    1.) why not? it could be helpful for controlling scope of nested class structures... [in my case]

    2.) oh yeah that's right, differentiating modules... but apart from that, any?

    3.) figures.
    hasafraggin shizigishin oppashigger...

  4. #4
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    1. When writing stuff like makefiles, or trying to make code less dependant on other code, it really helps to be able to see all the dependcies directly.

    2. I don't really know (GCC complains when you try to compile a header though).
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  5. #5
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    1.) okay, globals are sparse [nonexistant] and externally declared [locally instantiated] data is well documented...

    2.) okay, fair enough, any other takers?
    hasafraggin shizigishin oppashigger...

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, 03:42 AM
  3. #include header files or .cpp files?
    By DoctorX in forum C++ Programming
    Replies: 3
    Last Post: 12-23-2006, 12:21 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM