turbo platform module

group turbo_function_macro

Defines

TURBO_HOT

This macro is used to mark a function as hot.

The TURBO_HOT macro is used to mark a function as hot. This attribute is used to inform the compiler that a function is a hot spot in the program. The function is optimized more aggressively and on many platforms special calling sequences are used. For example, on ARM targets a function marked as hot is expected to be called more often than a cold function. This attribute is often used to mark functions that are called frequently inside loops.

int foo() TURBO_HOT;

Note

This attribute is not implemented in GCC versions earlier than 4.3.0.

Note

This attribute is not implemented in Clang versions earlier than 3.0.

Note

This attribute is not implemented in MSVC.

Note

This attribute is not implemented in ICC.

Note

This attribute is not implemented in IBM XL C/C++.

Note

This attribute is not implemented in TI C/C++.

Note

This attribute is not implemented in ARM C/C++.

Note

This attribute is not implemented in TI C/C++.

Note

This attribute is not implemented in TI C/C++.

Note

This attribute is not implemented in TI C/C++.

TURBO_MUST_USE_RESULT

This macro is used to mark a function as must use result.

The TURBO_MUST_USE_RESULT macro is used to mark a function as must use result. This attribute is used to inform the compiler that a function must be used. The function is optimized more aggressively and on many platforms special calling sequences are used. For example, on ARM targets a function marked as must use result is expected to be called more often than a cold function. This attribute is often used to mark functions that are called frequently inside loops.

TURBO_MUST_USE_RESULT int foo();

Note

after c++17, use [[nodiscard]] instead.

TURBO_FORCE_INLINE

This macro is used to force inline a function.

The TURBO_FORCE_INLINE macro is used to force inline a function. This attribute is used to inform the compiler that a function is a hot spot in the program. The function is optimized more aggressively and on many platforms special calling sequences are used. For example, on ARM targets a function marked as hot is expected to be called more often than a cold function. This attribute is often used to mark functions that are called frequently inside loops.

TUROB_FORCE_INLINE int foo();

Note

This attribute is not implemented in GCC versions earlier than 3.1.0. This attribute is not implemented in Clang versions earlier than 3.0.0. This attribute is not implemented in MSVC. This attribute is not implemented in ICC. This attribute is not implemented in IBM XL C/C++. This attribute is not implemented in TI C/C++. This attribute is not implemented in ARM C/C++. This attribute is not implemented in TI C/C++. This attribute is not implemented in TI C/C++.

TURBO_FORCE_INLINE_LAMBDA

This macro is used to force inline a lambda function.

Force inlining a lambda can be useful to reduce overhead in situations where a lambda may may only be called once, or inlining allows the compiler to apply other optimizations that wouldn’t otherwise be possible.

The ability to force inline a lambda is currently only available on a subset of compilers.

Example usage:

auto lambdaFunction = []() TURBO_FORCE_INLINE_LAMBDA
{
};