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

Macros

#define hint_lifetimebound
 [[lifetimebound]]
 
#define hint_noescape
 portable __attribute__((noescape))
 

Detailed Description

Macro Definition Documentation

◆ hint_lifetimebound

#define hint_lifetimebound

[[lifetimebound]]

The argument must be kept alive as long as the result of the function is alive. Should be used for functions that return references or views into the target object.

This is a strong hint that this object "owns" the result and is just letting you borrow it.

Editorial:

As a rule of thumb all pointer arguments should be analyzed to be either hint_noescape or hint_lifetimebound, and hint_lifetimebound should be applied to all methods that return a self-reference

◆ hint_noescape

#define hint_noescape

portable __attribute__((noescape))

argument is not captured by the function (rust-style borrow)