I worked with several C projects during my programming career, and header file structures usually fall into one of these two patterns:
- One header file containing all function prototypes
- One
.hfile for each file .ccontaining prototypes for functions defined only in this module.
The advantages of option 2 are obvious to me - it makes it cheaper to split a module between several projects and makes it easier to view dependencies between modules.
But what are the benefits of option 1? It must have some advantages, otherwise it will not be so popular.
This question applies to both C ++ and C, but I have never seen # 1 in a C ++ project.
Placement #defines, structetc. also changing, but for this question I would like to focus on function prototypes.
finnw source
share