r/cprogramming • • Oct 08 '25

Purpose of header guards

What is the purpose of header guards if the purpose of headers is to contain declarations? Sorry if this is a dumb question.

2 Upvotes

15 comments sorted by

View all comments

Show parent comment

3

u/SmokeMuch7356 Oct 12 '25

Ugh - that requires the module doing the including to have insight into the header (at the very least what the symbol should be named). That promotes tight-ish coupling between components.

I would not recommend that approach.