SPARC Assembly Language Reference Manual

Exit Print View

Updated: July 2014
 
 

7.1.7 Inline Templates in C++

To prevent linker errors, calls to inline template functions in C++ must be enclosed in an extern “C” declaration. For example:

extern "C"
  {
    void nothing();
  }

int main()
{
  nothing();
}

Inline template function:

.inline nothing
  nop
.end

7.1.7.1 C++ Inline Templates and Exceptions

In C++, #pragma no_side_effect cannot be combined with exceptions. But we know that the code cannot produce exceptions. The compiler might be able to produce even better code by adding the throw()keyword to the template declaration:

extern "C"
  {
    int mytemplate(int) throw(); 
    #pragma no_side_effect(mytemplate)
  }