3 ms·
Re stack allocation: It requires you to know how large the object could possibly be at compile time Just wanted to point out that alloca exists pretty much eve
by barrkel 13y ago
Re stack allocation: It requires you to know how large the object could possibly be at compile time
Just wanted to point out that alloca exists pretty much everywhere, so you don't need to know the exact size at compile time. You still need to know you're not going to overflow your stack, of course.
There are also variable-sized stack allocated arrays, as in C99 and gcc extension.
Though IMO the value of a consistent approach outweighs the small performance advantages of dynamic stack allocation - it would very very rare for me to use either approach today.