News for hackers. Stuff that matters.
Re:C or C++ for my game engine? by mikekchar on Monday January 18, 2016 @08:17AM (#10924184)
It is quite possible that I'm out of date (haven't used C++ in anger for the better part of a decade), but local variable allocations have always historically been on the stack. Just don't use new. Arrays will be allocated on the stack as long as they are fixed length.

And yes, this rules out the STL :-(

Re:C or C++ for my game engine? by loup-vaillant on Monday January 18, 2016 @09:09AM (#10924431)
> local variable allocations have always historically been on the stack

And they still are, thank goodness. My point was that as soon as you call a constructor, all bets are off: for instance, merely declaring an std::string allocates on the heap, local variable or no. But it seems you already knew that.

I think it is important to distinguish scoped discipline from stack allocation. The former is a way to program. The later is an implementation detail (modulo performance). Your wording was a tiny bit sloppy, so I jumped at it.