C++ Logo

std-proposals

Advanced search

Re: [std-proposals] What a non-reallocating version of the standard would look like.

From: Adrian Johnston <ajohnston4536_at_[hidden]>
Date: Sat, 30 May 2026 14:04:04 -0700
*>> Let's say you had to track a dynamic set of other entities (clouds,
aircraft, navigation stations) you had to*
*>> decide how many of those you could track at maximum at any given time
and if the maximum is reached*
*>> then only keep the most relevant and it wouldn't be able to track more;*

And hopefully you had a test suite that proved the maximums could be
handled gracefully. It scares me a little that C was considered safer for
avionics, but it makes an interesting point.

*>> If you need to use C++, if that was ever a practice (instead of the
current just use C), a large chunk of*
*>> the std library would be straight out off limits to use.*

What we used to do was use the std library for building memory images that
would be loaded into the runtime. If you are running command line tools
then you can replace global new and delete with a simple stack allocator
that only increments a pointer and doesn't ever reclaim memory. Then the
process just exits and that is how resources are reclaimed. This saves you
30% CPU.

And then we were not allowed to use the std library at runtime. All you
really need is an array class. Once you start really optimizing it is all
Structures of Arrays (SoA) and Arrays of Structures (AoS) because you are
doing hot and cold sorting for cache coherency. But it is nice having a
real container library for large embedded projects.

Received on 2026-05-30 21:04:17