SPARC Assembly Language Reference Manual

Exit Print View

Updated: July 2014
 
 

7.1 Inline Function Templates in C and C++

The following are examples where inline templates are particularly useful:

  • Hand-coded mutex locks using atomic instructions.

  • Machine-level access for a hardware device or to access certain hardware registers.

  • Precise implementation of algorithms that can be implemented optimally using hand-coding that the compiler is unable to replicate.

Inline templates appear as normal function calls in the C/C++ source code. When the source code program cc -O prog.c code.il and the file containing the inline template defining the function are compiled together, the compiler will insert the code from the inline template in place of the function call in the code generated from the C/C++ source code.