Next: , Up: Pragmas   [Contents]


18.1 Inlining

A declaration of the form

:- pragma inline(Name/Arity).

is a hint to the compiler that all calls to the predicate(s) or function(s) with name Name and arity Arity should be inlined.

The current Mercury implementation is smart enough to inline simple predicates even without this hint.

A declaration of the form

:- pragma no_inline(Name/Arity).

ensures the compiler will not inline this predicate. This may be used simply for performance concerns (inlining can cause unwanted code bloat in some cases) or to prevent possibly dangerous inlining when using low-level C code.