Do not use alloca inside a loop #21

Merged
ryanlerch merged 1 commit from alloca-loops into master 2022-02-11 12:34:45 +00:00
Showing only changes of commit 5c5f165d92 - Show all commits

View file

@ -681,7 +681,8 @@ is released at the end of the function and not at the end of
the block where it is defined, thus it is reccommended to not
call `alloca` inside a loop. In this regard, VLA behaves better,
considering the memory allocated with VLA is released at the end
of the block that defines them.
of the block that defines them. Do not mix VLA and `alloca` though,
otherwise this behaviour is not guaranteed for VLA either!
[[sect-Defensive_Coding-C-Allocators-Arrays]]
=== Array Allocation