Skip to content

Comment on Defective C++parent

Comments

The existence of .h files

C or C++ don't specify or require .h files. The languages don't even specify any file extension.

What C and C++ specify is the concepts of declaration and definition, and require only one definition across all translation units. Thus it's customary to simply have a single source for declarations to ensure they all stay consistent in spite of their usages, and those declarations are used once by wrapping them in include guards.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.