native 0.0.1
Vectors, masks and wide register packs for C++26
Loading...
Searching...
No Matches
Object Lifetimes
Collaboration diagram for Object Lifetimes:

Macros

#define native_lifetimebound
 [[lifetimebound]]
#define native_noescape
 portable __attribute__((noescape))
#define native_nodiscard   [[nodiscard]]
 C++17 [[nodiscard]].

Detailed Description

Macro Definition Documentation

◆ native_lifetimebound

#define native_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 native_noescape or native_lifetimebound, and native_lifetimebound should be applied to all methods that return a self-reference

Definition at line 161 of file attributes.h.

◆ native_nodiscard

#define native_nodiscard   [[nodiscard]]

C++17 [[nodiscard]].

The user should explicitly throw away the result rather than let it be silently discarded

Note: Despite being already standard, this is used primarily to annotate the definition with a [[nodiscard]] qualifier in DOXYGEN.

Definition at line 189 of file attributes.h.

◆ native_noescape

#define native_noescape

portable __attribute__((noescape))

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

Definition at line 175 of file attributes.h.