r6.1.1:LFDS611_INLINE

From liblfds.org
Jump to navigation Jump to search

Source File

/liblfds611/inc/liblfds611.h

Define

#define LFDS611_INLINE   [compiler inline directive]

Parameters

No parameters.

Return Value

No return value.

Notes

The atomic instructions used by liblfds in the end always come down to a single machine instruction. Part of the reason for using lock-free data structures is performance. As such, it is important to indicate to the compiler that it should if at all possible avoid the overhead of a function call every time one of the atomic instructions is called. To achieve this, compilers provide a keyword which permits the code author to indicate that a given function should be inlined. This macro is the mechanism by which the compiler specific keyword for function inlining is provided to liblfds.

Examples

On Windows, with the Microsoft C compiler, there exists the keyword __forceinline.

As such, the implementation of LFDS611_INLINE on Windows with the Microsoft C compiler looks like this;

#define LFDS611_INLINE   __forceinline

With GCC, there exists the keyword inline.

As such, the implementation of LFDS611_INLINE on GCC looks like this;

#define LFDS611_INLINE   inline

See Also