PDA

View Full Version : header files usage



doubleanti
01-20-2002, 12:40 AM
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

SilentStrike
01-20-2002, 12:52 AM
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.

doubleanti
01-20-2002, 12:54 AM
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.

SilentStrike
01-20-2002, 01:00 AM
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).

doubleanti
01-20-2002, 01:01 AM
1.) okay, globals are sparse [nonexistant] and externally declared [locally instantiated] data is well documented...

2.) okay, fair enough, any other takers?