question on header files

Let's say I have to include other header files into a separate c++ component( comprising of also a header and a cpp file)
By convention, is it better to put it in the .h or the .cpp file?

oh and what is the convention for naming .h files as well, is it camel case, with or without the first letter capitalized, etc?
Last edited on
Let's say I have to include other header files into a separate c++ component( comprising of also a header and a cpp file)
By convention, is it better to put it in the .h or the .cpp file?

It depends on what are the dependencies. If the declarations in the second header don't depend on the declarations on the first one and the first header isn't needed in the other files which will use the second header or you don't want to be visible to those you should include it on the source file. If you don't care or the first header is useful to be included somewhere else you should include it on the second header.

oh and what is the convention for naming .h files as well, is it camel case, with or without the first letter capitalized, etc?

On systems where filenames case don't matter this is not a problem but for the other I would suggest having all the letters lowercase so it would be less confusing
Topic archived. No new replies allowed.