openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

Minimizing headers complexity

Open dimitre opened this issue 6 months ago • 0 comments

Some measures were made in previous PRs trying to reduce .h includes in .h files And there is room for more optimization.

PRs

  • https://github.com/openframeworks/openFrameworks/pull/7779
  • https://github.com/openframeworks/openFrameworks/pull/7784
  • https://github.com/openframeworks/openFrameworks/pull/7792
  • https://github.com/openframeworks/openFrameworks/pull/7815

Other related

  • https://github.com/openframeworks/openFrameworks/pull/7918
  • https://github.com/openframeworks/openFrameworks/pull/7908

Done in previous PRs

  • [x] changing #include to forward declarators when possible;
  • [x] changing #include to template forward declarations when possible;

Done, but can be improved

  • [ ] Reducing utilizing headers include inside other headers, try to explicitely declare needed headers. example of something that can be improved: ofParameter.h includes ofPoint which includes ofVec3f (inline only) which adds ofVec2f and ofVec4f one useful tool is the compiler (clang fork) include-what-you-need easily installed via brew in macos.

Next Ideas (we can discuss each one)

  • [ ] https://github.com/openframeworks/openFrameworks/issues/7814
  • [x] Substitute including ofConstants.h in headers that use only for deprecation and favor c++14 [[deprecate]]
  • [ ] move ofVec3f inline functionality for a cpp file
  • [ ] converting some regular objects used only once in header files to pointers (unique_ptr) so their includes can be replaced by forward declarators

dimitre avatar Dec 04 '23 01:12 dimitre