#Define C difference between the sum of inline

1.define

  1. Define macro process precompiled only simple string replacement, no type checking

2.inline

  1. inline function is used to define a referenced inline main reason is that it replace the C language macro definition expression of the form;

  2. On completion of the compilation phase ;

  3. inline function will do the types of security checks ;

  4. The embedded code is inline function, when called inline functions, not jump to inline functions, but the code is directly written inline function call site .

  5.inline function is only a function for short (less complex logic, and generally less than 10 lines of the function), can improve certain efficiency, and macro comparison, inline function is more secure and reliable .

  6. disadvantages: increased consumption of memory space ;

 

3. Define inline function just a suggestion to the compiler, but the final decision depends on the compiler, if the logic is more complex inline function (or a recursive circulation and the like), this time could be inlined fail.

 

 

Guess you like

Origin www.cnblogs.com/weiyouqing/p/12568562.html