Earlier quoted context omitted.
dynamic memory allocation is very much frowned upon in embedded systems, not just for strings. Everything should be static and deterministic at all times. This is the easiest/only way to ensure you have no resource issues. You should always (statically) allocate for maximum/worst case.. because you have analysed your worst-case, haven't you?
How do you analyze worst case ? don't you need to know what calls what, up to what depth, and that's dynamic by nature ?
As for the stack usage requirements, it seems like this could be determined statically by some parametric process, but I’m no expert on this.
Does anyone see a reason why there couldn’t be some algorithm to statically analyze some code to derive the worst case stack usage?
For example, take every function and assume that every variable declaration will be required. Add them up. Then, follow every path down the call tree while adding up the required stack for each call.