Bounded Versus Unbounded Variable-Size Data

You can generate code for bounded and unbounded variable-size data. Bounded variable-size data has fixed upper bounds; this data can be allocated statically on the stack or dynamically on the heap. Unbounded variable-size data does not have fixed upper bounds; this data must be allocated on the heap. If you use unbounded data, you must use dynamic memory allocation so that the compiler:

  • Does not check for upper bounds

  • Allocates memory on the heap instead of the stack

You can control the memory allocation of variable-size data. For more information, see Control Memory Allocation of Variable-Size Data.

Was this topic helpful?