Skip to content

Commit

Permalink
Change memory storage duration to automatic
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-eds committed Feb 15, 2024
1 parent 6fc644a commit 92be499
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ pointer is aligned to the specified `Alignment`.

_Remarks_: In case of private memory exhaustion, the underlying backend must
report an error in the same fashion as if the allocation size were static. In
case of a successful call, memory is freed automatically when the function which
called `private_alloca` returns to its caller. Additionally, `SpecName` must
have a default value of at least 1 and not be set to a value less than 1 during
program execution. Violation of these conditions results in undefined behavior.
case of a successful call, allocated memory has automatic storage
duration. Additionally, `SpecName` must have a default value of at least 1 and
not be set to a value less than 1 during program execution. Violation of these
conditions results in undefined behaviour.

== Example usage

Expand Down Expand Up @@ -185,9 +185,9 @@ The big design constraint stems from the unknown allocation size at compile
time. C++ does not support variable length arrays and complete type sizes must
be known at compile time. Thus, the free function interface returning a pointer
to private memory is the better way to represent this construct in C++. Lifetime
of the underlying memory region was a concern too, but the current design
automatically freeing the memory when the caller is returned is in line with
similar constructs in other platforms.
of the underlying memory region was a concern too, but the current design with
automatic storage duration for the allocated memory region closely follows what
the user would get from a stack-allocated array.

== Issues

Expand Down

0 comments on commit 92be499

Please sign in to comment.