Author Topic: How to exclude unused functions  (Read 11627 times)

Offline Krice

  • Almost regular
  • **
  • Posts: 150
Re: How to exclude unused functions
« Reply #15 on: November 25, 2016, 01:05:23 pm »
Everything is smooth except that code size is not optimized even after I opted for optimize size. I am not an expert. So  in my final object file how to exclude the functions that are not called.

If the program is extremely small then optimization flags (-Ox) are not that effective. More depends on how you write the code. Compiler optimization is mainly designed for "normal" projects and has varying results depending on a lot of stuff. Sometimes different levels of -O is giving surprising results both in speed and size of the program, so you should try every level. And the last tip, don't write functions that are not used in the project, it's considered bad design.