Interface __PURE_ATTR__

Preprocessor macro expanding to a type attribute

#include <SYS/TYPES.H>

int __PURE_ATTR__ function(args...);

Description

This macro expands to a compiler-specific attribute telling that the function doesn't have side effects. Its return value may depend on its arguments or on content of program's memory, but it may not change content of program's memory.

__PURE_ATTR__ has weaker requirements than __CONST_ATTR__. Any function that is const, is pure, but some functions may be pure and not const.

It enables the compiler to do better optimizations.

Implementation note

When using the gcc compiler, this macro expands to __attribute__((__pure__)).

See also

__CONST_ATTR__