Loading...
Searching...
No Matches
forceinline.hh File Reference

Provide the macro DUNE_FORCE_INLINE that expands to attribute always_inline or similar depending on the compiler (version). More...

Go to the source code of this file.

## Macros

#define | DUNE_FORCE_INLINE inline

## Detailed Description

Provide the macro DUNE_FORCE_INLINE that expands to attribute always_inline or similar depending on the compiler (version).

Some information is extracted from https://meghprkh.github.io/blog/posts/c++-force-inline.

The effect of DUNE_FORCE_INLINE is typically as follows:

- Inlining heuristics are disabled and inlining is always attempted regardless of optimization level.
- Ignore -fno-inline
- Ignore the inlining limits hence inlining the function regardless. It also inlines functions with allocation calls, which inline keyword never does.

Even when marked with DUNE_FORCE_INLINE, the compiler cannot always inline a function. Examples for such exceptions are

- The function is virtual and is called virtually.
- The program calls a function indirectly via a pointer to the function.
- The function uses a variable argument list.

Example:

DUNE_FORCE_INLINE int maxInt (int a, int b) { return a < b ? b : a; }
DUNE_FORCE_INLINE
#define DUNE_FORCE_INLINE
Definition forceinline.hh:52

## Macro Definition Documentation

## DUNE_FORCE_INLINE

#define DUNE_FORCE_INLINE inline