Joined: 25 May 2010 Posts: 501 Location: State of Jefferson
Posted: Sat 13 Jul 2013, 04:06 Post subject:
Re: headers file or not to header file
I'm putting this here as I suspect i'll get a better answer.
Should every application have header files?
When is a header file unnecessary?
Is there a way to build only the header files if they but not the actual package is needed?
1) No applications except those supporting plugins, and libraries.
Also protocols may justify headers without libraries.
Static libs always need headers.
2) When the binary does not meet the criteria in section 1, or when the target is not intended to be used for development.
Dynamic libs may be used solely for dependencies; in this case, it makes sense to distribute just the binaries.
When cross-compiling, it's ~ "any time you aren't trying to bootstrap a new self-hosting system".
3) Not for most packages. But many provide headers that don't need any "building".
Perhaps I am misunderstanding your question, i am also assuming you are referring to C.
The use of header files jives with C's modular approach. If you only have one file for source code, then certainly you don't need a header file, but assuming you want to modularize your code into functions, then you would want to keep these sections apart by using different C files and different header files.
You might want to look at what 'scope' means to a source files to gain a better understanding of modular functionality.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum