What are the advantages and disadvantages of using inline and const ?

Answers : Advantages of inline….

What are the advantages and disadvantages of using inline and const



  • It does not require function calling overhead.
  • It additionally save overhead of variables push/pop on the stack, while function calling.
  • It also save overhead of return call from a function.
  • It increases locality of reference by utilizing instruction cache.
  • Inline function may be useful (if it is small) for embedded systems because inline can yield less code than the function call outline and return.


  • If you use too many inline functions then the size of the binary executable file will be large, because of the duplication of same code.
  • Too much inlining can also reduce your instruction cache hit rate, thus reducing the speed of instruction fetch from that of cache memory to that of primary memory.
  • It may cause compilation overhead as if somebody changes code inside inline function than all calling location will also be compiled.



  • If you want any variable to keep constant through out the program then you can use const keyword.
  • It is stored in the read only of the initalized data segment , even the pointer storing it’s location cannot change the value of it, pointer can just change the address to point at some other location.


  • As the const is not flexible so mostly people use #define which is more flexible than const.
Leave a Reply

Your email address will not be published.