Skip to content

Mark private methods of public classes as unexported

Friedrich W. H. Kossebau requested to merge work/kossebau/unexportsymbols into master

Given the methods are marked as private and thus not intended for external use, exporting the symbols adds some minor unneeded costs in binary size and linking time, which can be avoided.

Not so pretty declaration code as result, but C++ might not enable something more simple.

For some data as motivation:

  • reduction of exported text section symbols number by 8,76 % (2626->2396).
  • stripped debug build binary size did some 0.6 % (7057864->7014920) shrink, might be better in release build when the compiler could now do more inlining because the unpexorted method entry points no longer need to be kept around

Merge request reports