Macros

API attributes

ULIB_BEGIN_DECLS

Marks the beginning of declarations.

ULIB_END_DECLS

Marks the end of declarations.

ULIB_API

Marks public API, whose symbols should be exported.

ULIB_INLINE

Marks inline function definitions.

ULIB_PURE

Marks pure functions.

A pure function is a function that has no effect on the state of the program other than returning a value.

Note

This lets the compiler sometimes produce more optimized code.

ULIB_CONST

Marks const functions.

A const function is a pure function whose return value is not affected by changes to the state of the program.

Note

This lets the compiler sometimes produce more optimized code.

Warning

Should not be used on functions that accept pointer arguments, unless the contents of the pointed-to memory never change between successive invocations.

ulib_unused

Suppresses unused variable warnings.

Utilities

ulib_swap(T, x, y)

Swaps the contents of two variables.

Parameters:
  • T – Variable type.

  • x – First variable.

  • y – Second variable.

ulib_array_count(array)

Returns the number of elements of an array.

Parameters:
  • array – The array.

Returns:

Number of elements.

ulib_analyzer_assert(exp)

Give hints to static analyzers, asserting that exp is true.

Parameters:
  • expboolean expression Boolean expression.

ULIB_MACRO_CONCAT(a, b)

Concatenates the a and b tokens, allowing a and b to be macro-expanded.

Parameters:
  • atoken First token.

  • btoken Second token.