Hint 0.1.0
Loading...
Searching...
No Matches
Macros

Macros

#define hint_const
 [[const]] is not const
 
#define hint_pure
 [[pure]]
 

Detailed Description

Macro Definition Documentation

◆ hint_const

#define hint_const

[[const]] is not const

Indicates the result is entirely determined by the arguments
and does not access main memory in any way, including accessing
members of `this`

This allows the compiler to easily elide/duplicate calls, because
it doesn't need to consider aliasing at all when moving this
function's body around.

WHEN IN DOUBT USE `hint_pure`, which is a much safer way to annotate
pure functional code 

◆ hint_pure

#define hint_pure

[[pure]]

No side-effects other than return value, may inspect globals

Allows the compiler to easily elide/duplicate calls. This can freely commute past other operations that can be shown not to affect the memory locations read.