Circular dependency between C header files -


does have tip how handle symbolic constants , types definition in large program in system manner avoid circular dependencies between header files? have idea define 1 header file contain structs, unions , enum types definitions , header file contain symbolic constants definitions. have doubts far solution regarding implementation hiding. thank ideas.

the solution simple use manner of program design. each "object"/"module" in program should consist of 1 h file , 1 c file. h file public interface. each such object should concerned own designated task. should include resources needed perform task.

with such design, there should never circular dependencies, or design flawed. should not fix bad design various code tricks, should re-do design.

but of course same resource included multiple time different parts of code. why use header guards in every single h file.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -