It slowly dawned on me that a big share of c++ programming headaches (confusions, compiler/linker errors, makefile complexity) stem from one basic design of C — names need to be declare to the “world”, and separately defined.
This design gives rise to header files.
Variables/objects vs functions vs custom classes vs templates have different rules.
I think only objects (including static fields) obey this particular rule: the definition allocates (non-stack) memory.
I think class instance fields are completely different. See https://bintanvictor.wordpress.com/2017/05/01/c-class-field-are-defined-in-header-but-global-variables-has-singledefinitionrule/
I think functions are completely different. I blogged about function ODR — https://bintanvictor.wordpress.com/2017/06/15/odrclassesfree-functions/
Pimpl is one of many issues.